删除Zend Form错误消息

时间:2012-08-09 12:14:59

标签: zend-framework zend-form

如何删除Zend Form错误消息(值是必需的,不能为空)?

3 个答案:

答案 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:',
    ));