这是我的表单字段,
$this->addElement( 'text', 'title', array(
'placeholder' => 'Title',
'class' => 'form-control',
'required' => true,
'filters' => array( 'StringTrim' ),
'autocomplete' => 'off',
) );
我只需要错误字符串,如: 标题是必需的,不能为空。
答案 0 :(得分:1)
试试这个: -
$this->addElement( 'text', 'title', array(
'placeholder' => 'Title',
'class' => 'form-control',
'required' => true,
'filters' => array( 'StringTrim' ),
'autocomplete' => 'off',
'validators' => array(
array('NotEmpty', false, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Title is required and cant be empty')))
)
) );