Zend perks
1. StringLength Validator in Form
To use a regular expression in zend you regex mus b enclosed in (/) like /regex/
1. StringLength Validator in Form
Another way doing the same thing$this->addElement('text', 'password', array( 'label' => 'Password:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(8,20)) ) ));
2. Regular expression$this->addElement('textarea', 'comment', array( 'label' => 'Please Comment:', 'required' => true, 'validators' => array( array('validator' => 'StringLength', 'options' => array(0, 20)) ) ));
To use a regular expression in zend you regex mus b enclosed in (/) like /regex/
$this->addElement('text', 'password', array( 'label' => 'Password:', 'required' => true, //'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(8,20)), array('regex', false, array('pattern' => '/^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$/')) ) ));
No comments:
Post a Comment