From 5816533ce5763fea3e2014f99ded0d3121c1de5f Mon Sep 17 00:00:00 2001 From: Rafael Ostertag <rafael.ostertag@math.uzh.ch> Date: Tue, 10 May 2016 16:17:59 +0200 Subject: [PATCH] Remove validation states right before submit(). Not on save click. --- javascript/src/QfqForm.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/javascript/src/QfqForm.js b/javascript/src/QfqForm.js index 04a548259..949da51fb 100644 --- a/javascript/src/QfqForm.js +++ b/javascript/src/QfqForm.js @@ -278,9 +278,6 @@ var QfqNS = QfqNS || {}; n.QfqForm.prototype.handleSaveClick = function () { this.lastButtonPress = "save"; n.Log.debug("save click"); - // First, remove all validation states, in case a previous submit has set a validation state, thus we're not - // stockpiling them. - this.clearAllValidationStates(); this.submit(); }; @@ -325,6 +322,9 @@ var QfqNS = QfqNS || {}; alert.show(); return; } + // First, remove all validation states, in case a previous submit has set a validation state, thus we're not + // stockpiling them. + this.clearAllValidationStates(); this.form.submitTo(this.submitTo); }; @@ -658,11 +658,13 @@ var QfqNS = QfqNS || {}; $formGroup.removeClass("has-warning"); $formGroup.removeClass("has-error"); $formGroup.removeClass("has-success"); + $formGroup.removeClass("has-danger"); }; n.QfqForm.prototype.clearAllValidationStates = function () { - $('.has-warning,.has-error,.has-success').removeClass("has-warning has-error has-success"); + $('.has-warning,.has-error,.has-success,.has-danger').removeClass("has-warning has-error has-success" + + " has-danger"); $('[data-qfq=validation-message]').remove(); }; -- GitLab