From ab0a72a5a0babbdb4dc552031d7f9e12ca9ed409 Mon Sep 17 00:00:00 2001 From: jlukic Date: Wed, 4 Dec 2013 23:29:32 -0500 Subject: [PATCH] Fixes #402 issue with revalidation of forms always occuring on change --- src/modules/behavior/form.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/modules/behavior/form.js b/src/modules/behavior/form.js index 1fddd8532..4aaf0266a 100755 --- a/src/modules/behavior/form.js +++ b/src/modules/behavior/form.js @@ -158,12 +158,12 @@ $.fn.form = function(fields, parameters) { $field = $(this), $fieldGroup = $field.closest($group) ; - if( $fieldGroup.hasClass(className.error) ) { - module.debug('Revalidating field', $field, module.get.validation($field)); - module.validate.field( module.get.validation($field) ); - } - else if(settings.on == 'change') { - module.validate.field( module.get.validation($field) ); + if(settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) ) { + clearTimeout(module.timer); + module.timer = setTimeout(function() { + module.debug('Revalidating field', $field, module.get.validation($field)); + module.validate.field( module.get.validation($field) ); + }, settings.delay); } } } @@ -574,6 +574,9 @@ $.fn.form.settings = { on : 'submit', inline : false, + delay : 200, + revalidate : true, + transition : 'scale', duration : 150, @@ -609,7 +612,6 @@ $.fn.form.settings = { }, - templates: { error: function(errors) { var