Reputation: 7577
I doing a multi page form, but I'm not using sub form - just persisting the data in mySQL.
I want to use validators on each form, but to allow the form to submit even if validation fails. I want to use the validators instead to post a flag in my database to say whether or not the form passed or failed validation.
The reason for this is to allow each form to be updated over a period of weeks, but the final submission of all the forms is then subject to whether each separate form validated (according the the flag set in the database).
Any tips would be apprecited, especially on modifying the validation script.
Upvotes: 0
Views: 118
Reputation: 2213
I don't think you need to modify anything.
Zend doesn't to JavaScript form validation, it is done server-side, so a form is submitted and POST/GET data is generated regardless. It is only in your action that you call $form->isValid($_POST);
The action you are submitting your preliminary and final steps should be different, such as processPreliminaryAction()
and processFinalAction()
.
In your preliminary steps, you can iterate through submitted form Elements and call isValid()
on each element, then you can save whether or not the field was valid in MySQL along with its value.
In your final submission, you call isValid()
on the entire form and proceed with what you need to do only if it is TRUE.
Upvotes: 2