X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Fcontact.js;h=d3528dc5a9149b45e4bff0065c2230a495671a42;hb=1f6105289a49079809c2a4677b561bc82c62db88;hp=2f47875e5c74193cb32cbef8bf950eaf4d07c072;hpb=190fd621df4920c56a422c03663874cddaa67d64;p=syj.git diff --git a/public/js/contact.js b/public/js/contact.js index 2f47875..d3528dc 100644 --- a/public/js/contact.js +++ b/public/js/contact.js @@ -1,21 +1,16 @@ -/* 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 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].focus(); - errorElements[0].select(); + errorElements[0].highlight('#F08080').activate(); evt.stop(); } });