23377 Posts in 18296 Topics by 2867 members
|Go to End|
26 January 2014 at 1:05am
I have a form on a site I am building which is posted via ajax. It first runs through jQuery validate plugin validation, and on success POSTS through ajax.
If the form has been filled out correctly, all works well. But if for whatever reason client-side validation succeeds when it shouldn't have, when the ajax POST is made, the form detects a validation error (e.g. blank required name) & returns the full template HTML for the rendered page.
Because Ajax is POST'ing the form data, is there a way to manipulate the response? Rather than sending through the template HTML, return an json object of validation errors?
Looking into framework's form.php, I see the method getValidationErrorResponse. I guess I could subclass form and write my own getValidationErrorResponse to manage how the response is handled? However, is there something already pre-built into SS to manage this type of situation?
|Go to Top|