diff --git a/public/assets/javascript/app-public.js b/public/assets/javascript/app-public.js
index a4638b0c..073d0d94 100644
--- a/public/assets/javascript/app-public.js
+++ b/public/assets/javascript/app-public.js
@@ -53,24 +53,9 @@ $(function() {
case 'error':
if (data.messages) {
- $.each(data.messages, function(index, error) {
-
- /*
- * use the class as the selector if the input name is an array.
- */
- var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
-
- $(selector, $form)
- .after('
' + error + '
')
- .parent()
- .addClass('has-error');
- });
+ processFormErrors($form, data.messages);
+ return;
}
-
-
- var $submitButton = $form.find('input[type=submit]');
- toggleSubmitDisabled($submitButton);
-
break;
default:
diff --git a/public/assets/javascript/frontend.js b/public/assets/javascript/frontend.js
index ae0bba96..0b8b2c2f 100644
--- a/public/assets/javascript/frontend.js
+++ b/public/assets/javascript/frontend.js
@@ -3956,24 +3956,9 @@ function log() {
case 'error':
if (data.messages) {
- $.each(data.messages, function(index, error) {
-
- /*
- * use the class as the selector if the input name is an array.
- */
- var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
-
- $(selector, $form)
- .after('' + error + '
')
- .parent()
- .addClass('has-error');
- });
+ processFormErrors($form, data.messages);
+ return;
}
-
-
- var $submitButton = $form.find('input[type=submit]');
- toggleSubmitDisabled($submitButton);
-
break;
default: