Browse Source

Fixes #402 issue with revalidation of forms always occuring on change

pull/401/merge
jlukic 11 years ago
parent
commit
ab0a72a5a0
1 changed files with 9 additions and 7 deletions
  1. 16
      src/modules/behavior/form.js

16
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

Loading…
Cancel
Save