[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Forms.php,v 1.3 2004/11/08 13:48:29 jack Exp $ 17 * Description: Contains a variety of utility functions used to display UI 18 * components such as form vtiger_headers and footers. Intended to be modified on a per 19 * theme basis. 20 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 21 * All Rights Reserved. 22 * Contributor(s): ______________________________________.. 23 ********************************************************************************/ 24 25 /** 26 * Create javascript to validate the data entered into a record. 27 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 28 * All Rights Reserved. 29 * Contributor(s): ______________________________________.. 30 */ 31 function get_validate_record_js () { 32 global $mod_strings; 33 global $app_strings; 34 35 $lbl_last_name = $mod_strings['LBL_LIST_LAST_NAME']; 36 $lbl_user_name = $mod_strings['LBL_LIST_USER_NAME']; 37 $lbl_role_name = $mod_strings['LBL_ROLE_NAME']; 38 $lbl_new_password = $mod_strings['LBL_LIST_PASSWORD']; 39 $lbl_confirm_new_password = $mod_strings['LBL_LIST_CONFIRM_PASSWORD']; 40 $lbl_user_email1 = $mod_strings['LBL_LIST_EMAIL']; 41 $err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS']; 42 $err_invalid_email_address = $app_strings['ERR_INVALID_EMAIL_ADDRESS']; 43 44 $the_script = <<<EOQ 45 46 <script type="text/javascript" language="Javascript"> 47 <!-- to hide script contents from old browsers 48 function set_fieldfocus(errorMessage,oMiss_field){ 49 alert("$err_missing_required_fields" + errorMessage); 50 oMiss_field.focus(); 51 exit(); 52 } 53 54 function verify_data(form) { 55 var isError = false; 56 var errorMessage = ""; 57 if (trim(form.email1.value) == "") { 58 isError = true; 59 errorMessage += "\\n$lbl_user_email1"; 60 oField_miss = form.email1; 61 } 62 if (trim(form.role_name.value) == "") { 63 isError = true; 64 errorMessage += "\\n$lbl_role_name"; 65 oField_miss =form.role_name; 66 } 67 if (trim(form.last_name.value) == "") { 68 isError = true; 69 errorMessage += "\\n$lbl_last_name"; 70 oField_miss =form.last_name; 71 } 72 if(form.mode.value !='edit') 73 { 74 if (trim(form.user_password.value) == "") { 75 isError = true; 76 errorMessage += "\\n$lbl_new_password"; 77 oField_miss =form.user_password; 78 } 79 if (trim(form.confirm_password.value) == "") { 80 isError = true; 81 errorMessage += "\\n$lbl_confirm_new_password"; 82 oField_miss =form.confirm_password; 83 } 84 } 85 if (trim(form.user_name.value) == "") { 86 isError = true; 87 errorMessage += "\\n$lbl_user_name"; 88 oField_miss =form.user_name; 89 } 90 91 if (isError == true) { 92 set_fieldfocus(errorMessage,oField_miss); 93 } 94 if (trim(form.email1.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email1.value)) { 95 alert("The email id '"+form.email1.value+"' in the email field is $err_invalid_email_address"); 96 form.email1.focus(); 97 exit(); 98 } 99 if (trim(form.email2.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email2.value)) { 100 alert("The email id '"+form.email2.value+"' in other email field is $err_invalid_email_address"); 101 form.email2.focus(); 102 exit(); 103 } 104 if (trim(form.yahoo_id.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.yahoo_id.value)) { 105 alert("The email id '"+form.yahoo_id.value+"' in yahoo email field is $err_invalid_email_address"); 106 form.yahoo_id.focus(); 107 exit(); 108 } 109 if(form.mode.value != 'edit') 110 { 111 if(trim(form.user_password.value) != trim(form.confirm_password.value)) 112 { 113 set_fieldfocus("The password does't match",form.user_password); 114 } 115 check_duplicate(); 116 }else 117 { 118 form.submit(); 119 } 120 } 121 122 // end hiding contents from old browsers --> 123 </script> 124 125 EOQ; 126 127 return $the_script; 128 } 129 130 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |