diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-09-02 09:54:00 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-09-02 09:54:00 +0300 |
commit | 80ae3f2e585803041940d997519b20089ece7e3c (patch) | |
tree | a4203e93397c9fc5a5669a1df3d9d2d93e55964b /js/tbl_change.js | |
parent | 2bf07ffac6378ea77f3964fd37f7cdbb59c00cb0 (diff) |
Fix #11450 Validation fails when using functions
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/tbl_change.js')
-rw-r--r-- | js/tbl_change.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/js/tbl_change.js b/js/tbl_change.js index cd092afae0..29a186b3da 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -204,10 +204,6 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType) }); } - var removeOnclick = 1; - if ($("input[name='fields_null[multi_edit][" + multi_edit + "][" + urlField + "]']").length) { - removeOnclick = 0; - } // Unchecks the corresponding "NULL" control $("input[name='fields_null[multi_edit][" + multi_edit + "][" + urlField + "]']").prop('checked', false); @@ -227,10 +223,8 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType) // @todo: put back attributes if corresponding function is deselected } - // explanation of the last condition: - // if a function has been selected in the function drop-down, - // do not validate the input field - if (target.name && target.name.substring(0, 6) === "fields" && ! function_selected) { + if ($this_input.data('rulesadded') == null && ! function_selected) { + //call validate before adding rules $($this_input[0].form).validate(); // validate for date time @@ -303,9 +297,17 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType) } }); } - if (removeOnclick === 1) { - $this_input.removeAttr('onchange'); - } + $this_input.data('rulesadded', true); + } else if ($this_input.data('rulesadded') == true && function_selected) { + // remove any rules added + $this_input.rules("remove"); + // remove any error messages + $this_input + .removeClass('error') + .removeAttr('aria-invalid') + .siblings('.error') + .remove(); + $this_input.data('rulesadded', null); } } /* End of fields validation*/ |