我的Db_NoRecordExists
消息被 覆盖addErrorMessage
。
代码:
$emailaddress = new Zend_Form_Element_Text('EmailAddress');
$emailaddress->setRequired(true)
->setAttrib('size', '30')
->addFilters(array('StringTrim', 'StripTags'))
->addValidator('EmailAddress',TRUE)
->setDecorators($decorators)
->addErrorMessage('Please Enter Va`enter code here`lid Values.')
->setAttrib('MaxLength',100)
->setAttrib('onkeyup','setUserName()')
->setAttrib('onkeypress','setUserName()')
->setAttrib('onfocus','setUserName()')
->setAttrib('onchange','setUserName()')
->setAttrib('Maxlength', '100');
$emailaddress ->class="textbox";
和
public function isValid($data)
{
$this->getElement('EmailAddress')
->addValidator('Db_NoRecordExists', false, array(
'table'=>'puntermaster',
'field' => 'EmailAddress',
'messages' => array(Zend_Validate_Db_Abstract::ERROR_RECORD_FOUND => 'A user with email address already exists'),
'exclude' => array( 'field' => 'Sno', 'value' => $data['Sno'])
), TRUE);
return parent::isValid($data);
}