2008年9月15日星期一

Re: [fw-mvc] Zend_Dojo_Form combining server and client validation

With respect to your question, have you already searched this forum?
I am asking this because i already asked the same question a few days ago.
Mr Matthew answered this to me very clearly :)

This can be found here:
http://www.nabble.com/Zend_Dojo-Email-validation%2C-checkbox-and-Submit-dojo-form-question--please--td19441003.html

So your solution should be:
->addElement ( 'validationTextBox', 'email', array ('required' => true,
'label' => 'Email address', 'regExp' =>
'\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b', 'invalidMessage' =>
'Please provide valid Email address.', 'filters' => array ('StringTrim',
'StringToLower' ), 'validators' => array ('NotEmpty', array ('StringLength',
true, array (6, 20 ) ), array ('Regex', true, array ('/\w+/i' ) ) ) ) )

Prout Prout wrote:
>
> Hi everyone,
>
> I'm trying to setup client and server validation in a Zend_Dojo_Form.
> Anyone an idea how to do that ?
> Ex :
>
> $this->addElement(
> 'TextBox',
> 'email',
> array(
> 'value' => '',
> 'label' => 'Email address : ',
> 'trim' => true,
> 'propercase' => true,
> 'required' => true,
> 'Validator' => 'EmailAddress' // this doesn't work ? Can we combine these
> 2 ?
> )
> );
>
> $this->addElement(
> 'Text'
> )
>
> /*
> // I'd love to get this working with client side validation...
>
> $email = new Zend_Form_Element_Text('email');
> $email->setLabel('Email address : ')
> ->addValidator('EmailAddress')
> ->setRequired(true)
> ->addFilter('StringToLower');
> */
>
> _________________________________________________________________
> Sur Windows Live Ideas, découvrez en exclusivité de nouveaux services en
> ligne... si nouveaux qu'ils ne sont pas encore sortis officiellement sur
> le marché !
> http://ideas.live.com
>

--
View this message in context: http://www.nabble.com/Zend_Dojo_Form-combining-server-and-client-validation-tp19489088p19491604.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: