release: WRNexusJS 0.5.10
This commit is contained in:
@@ -194,6 +194,14 @@ export const VALIDATE_RUNTIME = String.raw`
|
||||
.then(function () { btns.forEach(function (b) { b.disabled = false; }); });
|
||||
}
|
||||
|
||||
function runSubmitGuards(form, event) {
|
||||
var guards = form.__wireSubmitGuards || [];
|
||||
for (var index = 0; index < guards.length; index += 1) {
|
||||
if (guards[index](event) === false) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function bind(form) {
|
||||
if (form.__wireValidateBound) return;
|
||||
var name = form.getAttribute("data-schema");
|
||||
@@ -219,6 +227,7 @@ export const VALIDATE_RUNTIME = String.raw`
|
||||
clearErrors(form, schema);
|
||||
hideSuccess(form);
|
||||
if (validateForm(form, schema) > 0) return; // client-invalid: stay put, errors shown
|
||||
if (!runSubmitGuards(form, e)) return;
|
||||
submitForm(form, schema);
|
||||
});
|
||||
function validateTarget(e) {
|
||||
|
||||
Reference in New Issue
Block a user