// ----- Core function validateAllValidatorsForControl(controlToValidate) { // ----- Revalidate all validators associated to this control for (i = 0; i < controlToValidate.Validators.length; i++) { ValidatorValidate(controlToValidate.Validators[i]); } } function trimSpaces(s) { // trim trailing spaces var returnString = s; //alert (returnString.length); while ('' + returnString.charAt(returnString.length - 1) == ' ') { returnString = returnString.substring(0, returnString.length - 1); } // trim leading spaces while ('' + returnString.charAt(0) == ' ') { returnString = returnString.substring(1, returnString.length); } //alert (returnString); //alert (returnString.length); return returnString; } // ----- The culture that the user has selected var ftSelectedCulture = "en-GB"; //------------------------------------------------------------------------------------ // Function: IsEmail // Purpose: Validate Email address - must be of form a@b.c -- in other words: // * there must be at least one character before the @ // * there must be at least one character before and after the . // * the characters @ and . are both required //------------------------------------------------------------------------------------ /** * JavaScript function to check an email address conforms to RFC822 (http://www.ietf.org/rfc/rfc0822.txt) * * Version: 0.2 * Author: Ross Kendall * Created: 2006-12-16 * Updated: 2007-03-22 * * Based on the PHP code by Cal Henderson * http://iamcal.com/publish/articles/php/parsing_email/ */ /* Portions copyright (C) 2006 Ross Kendall - http://rosskendall.com Portions copyright (C) 1993-2005 Cal Henderson - http://iamcal.com Licenced under Creative Commons _or_ GPL according to the terms below... -- Licensed under a Creative Commons Attribution-ShareAlike 2.5 License You are free: * to Share -- to copy, distribute, display, and perform the work * to Remix -- to make derivative works Under the following conditions: * Attribution. You must attribute the work in the manner specified by the author or licensor. * Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. * For any reuse or distribution, you must make clear to others the license terms of this work. * Any of these conditions can be waived if you get permission from the copyright holder. http://creativecommons.org/licenses/by-sa/2.5/ -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html */ function IsEmail(src) { // ----- We don't want multiple addresses entered, so we will not allow , or ; if (src.indexOf(",") > 0) { return false; } if (src.indexOf(";") > 0) { return false; } var input = $.trim(src); if (input.substr(input.length - 1, 1) == "'") { return false; } return /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test(src); }