app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.9.5 vs app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.10.1
- old
+ new
@@ -156,17 +156,17 @@
change: function() {
var
$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) );
+ 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);
}
- else if(settings.on == 'change') {
- module.validate.field( module.get.validation($field) );
- }
}
}
},
@@ -572,10 +572,13 @@
keyboardShortcuts : true,
on : 'submit',
inline : false,
+ delay : 200,
+ revalidate : true,
+
transition : 'scale',
duration : 150,
onValid : function() {},
@@ -605,10 +608,9 @@
// errors
error: {
method : 'The method you called is not defined.'
},
-
templates: {
error: function(errors) {
var