-- valugi <[EMAIL PROTECTED]> wrote
(on Friday, 12 September 2008, 03:50 AM -0700):
> 1. Request object error
> If you have errors in the request object when trying to make your forms to
> use dojo, here is some clue. Dojo dijits uses some html templates and
> .htaccess usually is not prepared for this.
> 
> .htaccess code:
> RewriteEngine on
> RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ index.php

I posted a message to this list a couple days ago regarding this. Use
the following rewrite rule instead:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L]

> 2. There is some error in the distribution that I have from zf. 1.6
> I jave requests to this path:
> 
> http://zf.mysite.com/js/dojo/dijit/form/nls/en/validate.js
> 
> But then english version of this script is not there, is in the parent
> folder.. just the english one.
> http://zf.mysite.com/js/dojo/dijit/form/nls/validate.js
> 
> Can someone point how to make a good compilation of the dojo library so we
> wont have this problems?

First off, can you send an HTML document that displayes this error for
me? I cannot reproduce it currently. Just save the HTML source of the
page that shows the issue.

Second, there are two ways you can get a Dojo release build:

  * go into the util/buildscripts/ subdirectory of the Dojo
    installation, and run './build_release.sh'. This will create a Dojo
    release build in the release/ subdirectory. Use that build for your
    application

  * download a build from the Dojo website

> 3. I want to validate a text field for emails. The below sintax is correct
> as Zend_Dojo_Form_Element inherits from regular Zend_Form_Element to which I
> can add validators for email. This means that dojo should make use of this
> validator on user side or I have to add a special validator plugin of Dojo
> itself in order to do the validation?

First off, ZF validators are server-side only; we have not implemented
any functionality to translate them to Dojo client-side validations.
This is for many reasons: no 1:1 correspondence between most ZF
validators and Dojo validation constraints; users can write custom ZF
validators, and we have no mechanisms for hinting to Dojo how to
interpret those.

So, this brings me to the second point: you'll have to use a dijit that
*can* perform validations. TextBox does not. I'd use ValidationTextBox,
and then provide it with a regExp property with a minimal regex for
vlaidating an email address:

> 
>               $email = new Zend_Dojo_Form_Element_TextBox( 'email' );

becomes:

                $email = new Zend_Dojo_Form_Element_ValidationTextBox( 'email' 
);

>               $email
>                       ->setLowercase( true )
>                       ->setMaxLength(40)

add this:

            ->setRegExp('[EMAIL PROTECTED],4}\b')

>                       ->setFilters(
>                               array(
>                                       new Zend_Filter_StringToLower(),
>                                       new Zend_Filter_StringTrim()
>                               )
>                       )       
>                       ->setLabel('Email')
>                       ->addValidator( new Zend_Validate_EmailAddress())
>                       ->setRequired( true )
>                       ;

and done.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to