From 047d6c002abfb498f20c09cf318fc4a10901837f Mon Sep 17 00:00:00 2001 From: jessib Date: Thu, 11 Jul 2013 11:41:06 -0700 Subject: Clear authentication errors before displaying new ones. --- users/app/assets/javascripts/users.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'users/app/assets') diff --git a/users/app/assets/javascripts/users.js b/users/app/assets/javascripts/users.js index 4195df8..2eb644b 100644 --- a/users/app/assets/javascripts/users.js +++ b/users/app/assets/javascripts/users.js @@ -3,7 +3,7 @@ // LOCAL FUNCTIONS // - var poll_users, prevent_default, form_failed, form_passed; + var poll_users, prevent_default, form_failed, form_passed, clear_errors; prevent_default = function(event) { return event.preventDefault(); @@ -15,6 +15,11 @@ }).done(process); }; + clear_errors = function() { + return $('#messages').empty(); + }; + + // // PUBLIC FUNCTIONS // @@ -38,6 +43,7 @@ // decorates the appropriate fields with the error messages. // srp.error = function(message) { + clear_errors(); var element, error, field; if ($.isPlainObject(message) && message.errors) { for (field in message.errors) { -- cgit v1.2.3