formAjaxBeforeSend - can i abort the ajax request with this?

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 ?

Calling xhr.abord() bu as i see in source code there is a bug with xhr argument here. I fixed it, will work correct in next release

As of today, I’m still unable to abort a form Ajax call with abort.
Snippet of code is like this:

$$(’#form_login’).on(‘formajax:beforesend’, function (e, data, xhr) {
var status = false;
if (!status)
xhr.abort()
}, true);

$$(’#form_login’).on(‘formajax:success’, function (e) {
//this part is supposed not to be run, but it actually still makes the call
});

“status” is a prop (str) of window-obj
it exist before you declare it

just open console (any)
type :

console.log(status) // => "" (exist, NOT undefined)
status=false;
console.log(status) // => "false" (string,NOT boolean)
var status=false;
console.log(status) // => "false" (again string,NOT boolean)
if(status){console.log(status,'is a string, not boolean')}

be carefull

This is not the problem I am currently having, it has nothing to do with the status variable.

When xhr.abort() is called in the beforesend, I presume that the ajax call won’t be made. Instead, it is still made ,and I end up in success callback.

This is wrong