0

Here is what my form field,

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

I Simply need the error string like: Title is required and can't be empty.

Rohit
  • 657
  • 6
  • 25

1 Answers1

1

Try this:-

$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')))
        )
    ) );
Ashwani
  • 692
  • 2
  • 6
  • 16