X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Faccount.js;h=20b893cf713f2fa0ba832108280d79835de9c9ba;hb=36fd88b7c9509509dc20070dae48883abe01a3fa;hp=ae4e3ecc213e5645bbddc22aac5a2b8379933864;hpb=9efd079d59d269811abc4c551b2f39ab2e6a05fb;p=syj.git diff --git a/public/js/account.js b/public/js/account.js index ae4e3ec..20b893c 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -1,23 +1,17 @@ -/* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier, +/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ 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"); @@ -50,8 +44,7 @@ document.observe("dom:loaded", function() { * if there are errors, cancel submission */ if (errorElements.length) { - errorElements[0].highlight('#F08080').focus(); - errorElements[0].select(); + errorElements[0].highlight('#F08080').activate(); evt.stop(); } });