1

How to remove Zend Form error mesessages (Value is required and can't be empty) ?

4

3 回答 3

2
$element->setRequired(false);
于 2012-08-09T12:53:10.347 回答
1

你可以试试这个:

$yourElement->removeDecorator('Errors'); 
于 2012-08-12T11:33:36.297 回答
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:',
    ));
于 2012-08-09T12:34:05.060 回答