如何删除Zend Form错误消息(值是必需的,不能为空)?
答案 0 :(得分:2)
$element->setRequired(false);
答案 1 :(得分:1)
你可以试试这个:
$yourElement->removeDecorator('Errors');
答案 2 :(得分:0)
您可以在此示例中覆盖错误消息:
$this->addElement('text', Model_User_Object::USERNAME, array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
array('notEmpty', true, array(
'messages' => array(
'isEmpty' => 'YOU CAN WRITE WHATEVER MESSAGE YOU WANT HERE.'
)
)
)
),
'required' => true,
'class' => 'input',
'label' => 'Your username:',
));