I am trying to apply some custom validation to an form-ajax-submit form.
I see the event formAjaxBeforeSend, which looks like it would be useful for doing some form validation and then preventing the ajax request from actually sending since its supposed to be before. I thought i’d be able to do something like this:
app.on(‘formAjaxBeforeSend’, function (formEl, data, xhr) {
var pass = $$('#new_password').val();
var pass_match = $$('#match_password').val();
if(pass !== pass_match){
xhr.abort();
status = 'error';
}
});
But xhr comes back undefined. Is there anyway i can interrupt the ajax request using formAjaxBeforeSend? or any other way to do validation with form-ajax-submit ?