[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /*+*********************************************************************************** 2 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 *************************************************************************************/ 9 Vtiger_BaseValidator_Js("Vtiger_PhoneValidator_Js",{},{ 10 error: "", 11 validate: function(){ 12 var field = this.fieldInfo; 13 var fieldValue = field.val(); 14 var strippedValue = fieldValue.replace(/[\(\)\.\-\ ]/g, ''); 15 16 if (fieldValue == "") { 17 18 this.getEmptyPhoneNumberError(); 19 20 } else if (isNaN(parseInt(strippedValue))) { 21 22 this.getPhoneNumberIllegalCharacterError(); 23 24 } else if (!(strippedValue.length == 10)) { 25 26 this.getPhoneNumberWrongLengthError(); 27 28 } 29 }, 30 31 getEmptyPhoneNumberError: function(){ 32 this.error = "You didn't enter a phone number.\n"; 33 return this.error; 34 }, 35 36 getPhoneNumberIllegalCharacterError: function(){ 37 this.error = "The phone number contains illegal characters.\n"; 38 return this.error; 39 }, 40 41 getPhoneNumberWrongLengthError: function(){ 42 this.error = "The phone number is the wrong length. Make sure you included an area code.\n"; 43 return this.error; 44 } 45 })
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |