diff --git a/app/assets/javascripts/sitewide/form_errors.js b/app/assets/javascripts/sitewide/form_errors.js index e62972481..2db026ef3 100644 --- a/app/assets/javascripts/sitewide/form_errors.js +++ b/app/assets/javascripts/sitewide/form_errors.js @@ -25,12 +25,6 @@ var renderFormError = function(ev, input, errMsgs, clearErr, errAttributes) { $form.clearFormErrors(); } - // Mark error form group - var $formGroup = $(input).closest('.form-group'); - if (!$formGroup.hasClass('has-error')) { - $formGroup.addClass('has-error'); - } - // Add error message/s var errorText = ($.makeArray(errMsgs).map(function(m) { if( m instanceof Array ) { @@ -40,6 +34,19 @@ var renderFormError = function(ev, input, errMsgs, clearErr, errAttributes) { } })).join('
'); + + if ($(input).hasClass('sci-input-field')) { + $(input).closest('.sci-input-container').addClass('error'); + $(input).closest('.sci-input-container').attr('data-error-text', errorText); + return; + } + + // Mark error form group + var $formGroup = $(input).closest('.form-group'); + if (!$formGroup.hasClass('has-error')) { + $formGroup.addClass('has-error'); + } + var $errSpan = "' + errorText + ''; $(input).after($errSpan);