From 734b5d02f2e1812ca0792343dcedd40ba6a73da2 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 2 Apr 2014 18:49:43 +0000 Subject: [PATCH] Add a parameter for submit() to skip the client-side widget validation --- etemplate/js/etemplate2.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 799599c885..108056e834 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -473,21 +473,30 @@ etemplate2.prototype.isDirty = function() * * @param {(et2_button|string)} button button widget or string with id * @param {boolean} async true: do an asynchronious submit, default is synchronious + * @param {boolean} no_validation - Do not do individual widget validation, just submit their current values * @return {boolean} true if submit was send, false if eg. validation stoped submit */ -etemplate2.prototype.submit = function(button, async) +etemplate2.prototype.submit = function(button, async, no_validation) { + if(typeof no_validation == 'undefined') + { + no_validation = false; + } + // Get the form values var values = this.getValues(this.widgetContainer); // Trigger the submit event var canSubmit = true; - this.widgetContainer.iterateOver(function(_widget) { - if (_widget.submit(values) === false) - { - canSubmit = false; - } - }, this, et2_ISubmitListener); + if(!no_validation) + { + this.widgetContainer.iterateOver(function(_widget) { + if (_widget.submit(values) === false) + { + canSubmit = false; + } + }, this, et2_ISubmitListener); + } if (canSubmit) {