From 5c81f355aeba4df5ea840540f302c2e55e1deddd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 5 Aug 2014 23:09:17 -0700 Subject: Validate user edit form --- public/js/setup.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'public/js/setup.js') diff --git a/public/js/setup.js b/public/js/setup.js index 357b908e..9552e715 100644 --- a/public/js/setup.js +++ b/public/js/setup.js @@ -35,11 +35,18 @@ return $("#symbol option[value='bitstamp']").attr('selected', 'selected'); } }).change(); - $('#address').change(function() { + $('#title').blur(function() { + if ($(this).val() === '') { + return $(this).parent().addClass('has-error'); + } else { + return $(this).parent().removeClass('has-error'); + } + }); + $('#address').blur(function() { if (check_address($(this).val())) { - return $(this).css('color', 'black'); + return $(this).parent().removeClass('has-error'); } else { - return $(this).css('color', 'red'); + return $(this).parent().addClass('has-error'); } }); $('#confirm').blur(function() { @@ -52,7 +59,9 @@ } }); $('#setup').submit(function() { - if ($('.has-error').length()) { + $('.form-control').blur(); + if ($('.has-error').length > 0) { + $('.has-error').effect('shake', 500); return false; } }); -- cgit v1.2.3