Zend validator help???
Posted: Fri Jun 26, 2009 12:21 pm
I have the following validation code for a username:
Works great except it doesn't include the name of the field so the error message looks like:
Cheers,
Alex
Code: Select all
$v = new Zend_Validate();
$v->addValidator(new Zend_Validate_StringLength(6, 12))
->addValidator(new Zend_Validate_Alnum());
if(!$v->isValid($user_name)){
$buffer = implode('<br />', $v->getMessages());
throw new Exception("<br />$buffer");
}Where the '' would contain the contents of the variable itself I would like to prefix that message with the field name so people knew what was going on???'' cannot be less than 6 characters
Cheers,
Alex