User registration form is a good example for this validator. Checking the username exists or not.
Db_NoRecordExists validator helps to achieve this
$username = new Zend_Form_Element_Text('username', array('label' => 'Username', 'required' => true, 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('NotEmpty', array('Db_NoRecordExists',false,array( 'users_table','username_column', 'messages' => array( Zend_Validate_Db_Abstract::ERROR_RECORD_FOUND => '%value% already exists') )))));
0 comments
Post a Comment