]> dev.renevier.net Git - syj.git/blobdiff - public/js/contact.js
fixes in ie: focus was not set correctly in forms
[syj.git] / public / js / contact.js
index 1213e6eb5e9c7ef9f04eb11db339a8a5eb3aef39..3afd99588bb268d69e686bcdac1192f3f18455ac 100644 (file)
@@ -3,19 +3,14 @@
 
 document.observe("dom:loaded", function() {
     var form = $("contactform");
-    form.focus();
+    form.setfocus();
 
     form.observe('submit', function(evt) {
         var control, errorElements;
 
         $$('.error').invoke('remove');
 
-        errorElements = $$('input:not([type="submit"]),textarea').findAll(
-            function(elt) {
-                return (!elt.check(function() {
-                    return !this.value.strip().empty();
-                }, SyjStrings.notEmptyField));
-            });
+        errorElements = this.checkEmptyElements(SyjStrings.notEmptyField);
 
         if (!errorElements.length) {
             control = $("contact_email");
@@ -30,8 +25,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();
         }
     });