app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.12.0 vs app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.12.2
- old
+ new
@@ -222,18 +222,22 @@
}
},
add: {
- prompt: function(field, errors) {
+ prompt: function(identifier, errors) {
var
- $field = module.get.field(field.identifier),
+ $field = module.get.field(identifier),
$fieldGroup = $field.closest($group),
$prompt = $fieldGroup.find(selector.prompt),
promptExists = ($prompt.size() !== 0)
;
- module.verbose('Adding inline error', field);
+ errors = (typeof errors == 'string')
+ ? [errors]
+ : errors
+ ;
+ module.verbose('Adding field error state', identifier);
$fieldGroup
.addClass(className.error)
;
if(settings.inline) {
if(!promptExists) {
@@ -255,10 +259,13 @@
$prompt
.fadeIn(settings.duration)
;
}
}
+ else {
+ module.verbose('Inline errors are disabled, no inline error added', identifier);
+ }
}
},
errors: function(errors) {
module.debug('Adding form error messages', errors);
$message
@@ -346,10 +353,10 @@
module.remove.prompt(field, fieldErrors);
$.proxy(settings.onValid, $field)();
}
else {
formErrors = formErrors.concat(fieldErrors);
- module.add.prompt(field, fieldErrors);
+ module.add.prompt(field.identifier, fieldErrors);
$.proxy(settings.onInvalid, $field)(fieldErrors);
return false;
}
return true;
},