1

I have a misunderstanding about zend non empty validation. I am using following code for zend form to generate a textarea

 $this->addElement('textarea', 'comment', array(
       // 'label'      => 'Please Comment:',
        'required'   => false,
        'validators' => array('NotEmpty')
    ));

If I change required attribute to false then It works and values are not gone to database. But Problem is that if I set requried=>true, It shows the validation message even before submit of form soemthing like this Value is required and can't be empty. Now What I want that this message shouldn't be shown before the form is submitted but validation of non empty should be implemented. Please guide where Am I wrong?

1 Answer 1

3

if you set 'required' => true Zend_Form append in automatic the validator NotEmpty to input textarea. The error messages are displayed only if you execute the method of the isValid() Form. Then calls the isValid the point that you feel most appropriate.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.