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