some cleanup - several user interface improvements
[openemr.git] / library / erx_javascript.inc.php
blobfdfa1f884667100572d17a4a8e9743d68e629af6
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 ZMG LLC <sam@zhservices.com>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Vinish K <vinish@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 <script type="text/javascript">
29 function checkLength(eleName,eleVal,len)
31 eleName=eleName.replace('form_','');
32 var m='';
33 if(eleVal.length>len)
34 m += '<?php echo xl("Invalid length for")." "; ?>'+eleName.toUpperCase()+'.<?php echo " ".xl("The length should not exceed the following number of characters")." : "; ?>'+len+"\n";
35 return m;
38 function checkSpecialCharacter(eleName,eleVal)
40 var regE = /[^a-zA-Z'\s,.\-]/;
41 var m='';
42 eleName=eleName.replace('form_','');
43 if(regE.test(eleVal)==true)
44 m += '<?php echo xl("Invalid character in")." "?>'+eleName.toUpperCase()+"\n";
45 return m;
48 function checkFacilityName(eleName,eleVal)
50 var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
51 var m='';
52 eleName=eleName.replace('form_','');
53 if(regE.test(eleVal)==true)
54 m += '<?php echo xl("Invalid character in")." "?>'+eleName.toUpperCase()+"\n";
55 return m;
58 function checkPhone(eleName,eleVal)
60 var regE = /[^0-9']/;
61 var m='';
62 eleVal_temp=eleVal.replace(/[^0-9]/ig,'');
63 eleVal=eleVal.replace(/[-)(\s]/ig,'');
64 eleName=eleName.replace('form_','');
65 eleName=eleName.replace('_',' ');
66 if(regE.test(eleVal)==true)
67 m += '<?php echo xl("Invalid non-numeric character in")." "?>'+eleName.toUpperCase()+"\n";
68 else if(eleVal_temp.length>10)
69 m += eleName.toUpperCase()+'<?php echo " ".xl("should contain only 10 digits") ?>'+"\n";
70 else if(eleVal_temp.length<10)
71 m += eleName.toUpperCase()+'<?php echo " ".xl("should contain 10 digits") ?>'+"\n";
72 return m;
75 function checkTaxNpiDea(eleName,eleVal)
77 var regE = /[^0-9]/;
78 var m='';
79 eleName=eleName.replace('_',' ');
80 if(regE.test(eleVal)==true)
81 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
82 return m;
85 function checkFederalEin(eleName,eleVal)
87 var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
88 var m='';
89 eleName=eleName.replace('_',' ');
90 if(regE.test(eleVal)==true)
91 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
92 return m;
95 function checkStateLicenseNumber(eleName,eleVal)
97 var regE = /[^a-zA-Z0-9 '.,()#:\/\-@_%\r\n]/;
98 var m='';
99 eleName=eleName.replace('_',' ');
100 if(regE.test(eleVal)==true)
101 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
102 return m;
105 function checkUsername(eleName,eleVal)
107 var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
108 var m='';
109 eleName=eleName.replace('form_','');
110 if(regE.test(eleVal)==true)
111 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
112 return m;
115 function checkAlphaNumeric(eleName,eleVal)
117 var regE = /[^a-zA-Z0-9\s]/;
118 var m='';
119 eleName=eleName.replace('form_','');
120 eleName=eleName.replace('_',' ');
121 if(regE.test(eleVal)==true)
122 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
123 return m;
126 function checkAlphaNumericExtended(eleName,eleVal)
128 var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
129 var m='';
130 eleName=eleName.replace('form_','');
131 eleName=eleName.replace('_',' ');
132 if(regE.test(eleVal)==true)
133 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
134 return m;
136 </script>