Skip to content

Commit

Permalink
Pass event object e and submission variable to after callback
Browse files Browse the repository at this point in the history
  • Loading branch information
dhjohn0 committed Oct 11, 2016
1 parent 7ded417 commit f97291f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build/formwarden.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/jquery.formwarden-pack.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions jquery.formwarden.js
Expand Up @@ -151,14 +151,14 @@ var fieldsEntered = {};
}
}else{
form[item.name] = val;
}
}
}
});

return form;
};

var validate = function (submission) {
var validate = function (submission, e) {
//get all the field value pairs
var form = getForm();
if (options.before) {
Expand All @@ -169,15 +169,15 @@ var fieldsEntered = {};
options.processErrors(results, fieldsEntered, submission);
options.processVisibility(results);
if (options.after) {
options.after(results.validForm, results);
options.after(results.validForm, results, submission, e);
}

return results.validForm;
};

$(this).submit(function (e) {
fieldsEntered = getForm();
if (!validate(true)) {
if (!validate(true, e)) {
e.preventDefault();
e.stopPropagation();

Expand All @@ -200,9 +200,9 @@ var fieldsEntered = {};
});

if (options.enableBlur) {
var updateFunction = function () {
var updateFunction = function (e) {
fieldsEntered[this.name] = true;
return validate();
return validate(false, e);
};

$("select[name]", validationForm).change(updateFunction);
Expand Down

0 comments on commit f97291f

Please sign in to comment.