have the callback utilize a return value #11

ghost opened this Issue Dec 19, 2011 · 1 comment

1 participant


it would be about 1000 times cooler if the callback returned a boolean which was used to indicate whether or not the form submit should take place.

Instead of

if (typeof this.callback === 'function') {
this.callback(this.errors, event);
if (this.errors.length > 0) {

do something like

var return_value = true;
if (typeof this.callback === 'function') {
return_value = this.callback(this.errors, event);
if (this.errors.length > 0 || return_value === false) {

that would really help when you do various ajax-y type of validation and form submits


I will think about utilizing a feature like this. In the meantime, you can prevent the form submission yourself by the following:

if (event && event.preventDefault) {
} else if (event) {
    event.returnValue = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment