]> dev.renevier.net Git - syj.git/blobdiff - public/js/account.js
allow anonymous routes creation
[syj.git] / public / js / account.js
index f6e204a29339816e71bc80565bcd17cea1052f51..d479e559b749ae0d2918d58373af3354842604d7 100644 (file)
@@ -11,13 +11,7 @@ document.observe("dom:loaded", function() {
 
         $$('.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();
         }
     });