Как отправить имя поля для обязательной истинной проверки в Zend

Вот то, что мое поле формы,

$this->addElement( 'text', 'title', array(
'placeholder' => 'Title',
'class' => 'form-control',
'required'   => true,
'filters'    => array( 'StringTrim' ),
'autocomplete' => 'off',
) );

Мне просто нужна строка ошибки, например:
Название обязательно и не может быть пустым.

0

Решение

Попробуй это:-

$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')))
)
) );
1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]