Commit 51c02312 by Qiang Xue

Merge pull request #1958 from 6pblcb/yiiActiveForm-beforeSubmit

Transfer beforeSubmit function after global validation all fields forms
parents 942370f8 d30ca6d1
......@@ -127,6 +127,13 @@
var $form = $(this),
data = $form.data('yiiActiveForm');
if (data.validated) {
if (data.settings.beforeSubmit !== undefined) {
if (data.settings.beforeSubmit($form) == false) {
data.validated = false;
data.submitting = false;
return false;
}
}
// continue submitting the form since validation passes
return true;
}
......@@ -135,7 +142,6 @@
clearTimeout(data.settings.timer);
}
data.submitting = true;
if (!data.settings.beforeSubmit || data.settings.beforeSubmit($form)) {
validate($form, function (messages) {
var errors = [];
$.each(data.attributes, function () {
......@@ -166,9 +172,6 @@
}, function () {
data.submitting = false;
});
} else {
data.submitting = false;
}
return false;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment