I am using zend framework. I have a text field which is a compulsory field. I also have a checkbox. On click of checkbox i want to hide the textfield and remove the compulsory attribute of the textfield.
For now I am usign jquery to simply hide the div in which the text field is placed but i got validation error as the text field is compulsory field.
Is it possible to remove the compulsory attribute of textbox on any event.
Could anyone please help me on this issue. Thanks.
I don’t think you can really make Zend form validators be dependent on JavaScript events.
But what you can do is overwrite
form::isValid()method, so that validators would be removed based on the data submitted