1 /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
2 and is published under the AGPL license. */
4 document.observe("dom:loaded", function() {
5 var form = $("contactform");
8 form.observe('submit', function(evt) {
9 var control, errorElements;
11 $$('.error').invoke('remove');
13 errorElements = this.checkEmptyElements(SyjStrings.notEmptyField);
15 if (!errorElements.length) {
16 control = $("contact_email");
17 if (!control.check(function() {
18 return this.value.match(/^[A-Z0-9._\-]+@[A-Z0-9][A-Z0-9.\-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}$/i);
19 }, SyjStrings.invalidMail)) {
20 errorElements.push($("contact_email"));
25 * if there are errors, cancel submission
27 if (errorElements.length) {
28 errorElements[0].highlight('#F08080').activate();