X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Faccount.js;h=f8b11d90f86fa185927c7998eb15f0de065c95b8;hb=a406f7ab23d1089170517a8997e1c2221e5748a0;hp=f6e204a29339816e71bc80565bcd17cea1052f51;hpb=190fd621df4920c56a422c03663874cddaa67d64;p=syj.git diff --git a/public/js/account.js b/public/js/account.js index f6e204a..f8b11d9 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -4,20 +4,14 @@ document.observe("dom:loaded", function() { var currentmail = $("account_email").value, form = $("accountform"); - form.focus(); + form.setfocus(); form.observe('submit', function(evt) { var control, errorElements; $$('.error').invoke('remove'); - errorElements = $$('#account_email, #account_password').findAll( - function(elt) { - return (!elt.check(function() { - return !this.value.strip().empty(); - }, SyjStrings.notEmptyField)); - }); - + errorElements = this.checkEmptyElements(SyjStrings.notEmptyField); if (!errorElements.length) { control = $("account_password"); @@ -30,7 +24,7 @@ document.observe("dom:loaded", function() { if (!errorElements.length) { control = $("account_password"); - if (control.check(function() { + if (!control.check(function() { return this.value === $("account_password_confirm").value; }, SyjStrings.passwordNoMatchWarn)) { errorElements.push(control); @@ -50,8 +44,7 @@ document.observe("dom:loaded", function() { * if there are errors, cancel submission */ if (errorElements.length) { - errorElements[0].focus(); - errorElements[0].select(); + errorElements[0].highlight('#F08080').activate(); evt.stop(); } });