diff options
Diffstat (limited to 'users/app/assets/javascripts')
-rw-r--r-- | users/app/assets/javascripts/users.js.coffee | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/users/app/assets/javascripts/users.js.coffee b/users/app/assets/javascripts/users.js.coffee index 75440ea..6d1dda2 100644 --- a/users/app/assets/javascripts/users.js.coffee +++ b/users/app/assets/javascripts/users.js.coffee @@ -36,7 +36,13 @@ srp.loggedIn = -> window.location = '/' srp.error = (message) -> - alert(message) + if $.isPlainObject(message) && message.errors + for key, value of message.errors + element = $('form input[name="session['+key+']"]') + next unless element + element.trigger('element:validate:fail.ClientSideValidations', value).data('valid', false) + else + alert(message) $(document).ready -> $('#new_user').submit preventDefault |