2009年9月7日星期一

Re: [fw-mvc] Validation identical in the form

-- whisher <whisher@mp4.it> wrote
(on Monday, 07 September 2009, 08:32 AM -0700):
> Hi. What's wrong in this code

What are you expecting to happen, and what is actually happening?

> $request = Zend_Controller_Front::getInstance()->getRequest();
> $password = $request->getParam('password', '');
> $this->addElement('password', 'password', array(
> 'required' => true,
> 'maxlength' => 15,
> 'title' => 'Sono ammessi solamente caratteri alfanumerici e @,#,*',
> 'label' => 'form_User_Register_Label_Password',
> 'filters' => array('StringTrim'),
> 'validators' => array(
> array('stringLength',true, array(2, 25)),
> array('regex', false, array('#^[^\.<>{};:"£$%\/^&()_\+\-=\]\[]+#')))
> ));
>
> // Re-Password
> $repassword = $request->getParam('repassword', '');
> $this->addElement('password', 'repassword', array(
> 'required' => true,
> 'maxlength' => 15,
> 'title' => 'Sono ammessi solamente caratteri alfanumerici e @,#,*',
> 'label' => 'form_User_Register_Label_RePassword',
> 'filters' => array('StringTrim'),
> 'validators' => array(
> array('stringLength',true, array(2, 25)),
> array('regex', true, array('#^[^\.<>{};:"£$%\/^&()_\+\-=\]\[]+#')),
> array('identical',false, array($password ,$repassword))
> )
> ));

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: