Regx validation in Zend Framework
- zendnwar
- July 20, 2012
- Zend basic
- 1 Comment
Regx validation in Zend Framework
Here showing Email validation.
$email = new Zend_Form_Element_Text(’email_address’);
$email->setLabel(‘Email Address:’)
->addValidators(
array(
array(‘regex’, false,
array(‘pattern’ => ‘/^.+@.+[.].{2,}$/i’))))
->setRequired(true)
->setAttribs(array(‘id’ => ’email_address’, ‘class’ => ‘input-text-field’))
->addErrorMessage(‘please enter a valid email address’);