forked from LibreHealthIO/lh-ehr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherx_javascript.inc.php
136 lines (127 loc) · 4.31 KB
/
erx_javascript.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
// +-----------------------------------------------------------------------------+
// Copyright (C) 2011 ZMG LLC <[email protected]>
//
//
// 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.
//
//
// A copy of the GNU General Public License is included along with this program:
// libreehr/interface/login/GnuGPL.html
// For more information write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Author: Eldho Chacko <[email protected]>
// Vinish K <[email protected]>
//
// +------------------------------------------------------------------------------+
?>
<script type="text/javascript">
function checkLength(eleName,eleVal,len)
{
eleName=eleName.replace('form_','');
var m='';
if(eleVal.length>len)
m += '<?php echo xl("Invalid length for")." "; ?>'+eleName.toUpperCase()+'.<?php echo " ".xl("The length should not exceed the following number of characters")." : "; ?>'+len+"\n";
return m;
}
function checkSpecialCharacter(eleName,eleVal)
{
var regE = /[^a-zA-Z'\s,.\-]/;
var m='';
eleName=eleName.replace('form_','');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." "?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkFacilityName(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
var m='';
eleName=eleName.replace('form_','');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." "?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkPhone(eleName,eleVal)
{
var regE = /[^0-9']/;
var m='';
eleVal_temp=eleVal.replace(/[^0-9]/ig,'');
eleVal=eleVal.replace(/[-)(\s]/ig,'');
eleName=eleName.replace('form_','');
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid non-numeric character in")." "?>'+eleName.toUpperCase()+"\n";
else if(eleVal_temp.length>10)
m += eleName.toUpperCase()+'<?php echo " ".xl("should contain only 10 digits") ?>'+"\n";
else if(eleVal_temp.length<10)
m += eleName.toUpperCase()+'<?php echo " ".xl("should contain 10 digits") ?>'+"\n";
return m;
}
function checkTaxNpiDea(eleName,eleVal)
{
var regE = /[^0-9]/;
var m='';
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkFederalEin(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
var m='';
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkStateLicenseNumber(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9 '.,()#:\/\-@_%\r\n]/;
var m='';
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkUsername(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
var m='';
eleName=eleName.replace('form_','');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkAlphaNumeric(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9\s]/;
var m='';
eleName=eleName.replace('form_','');
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
function checkAlphaNumericExtended(eleName,eleVal)
{
var regE = /[^a-zA-Z0-9 '().,#:\/\-@_%]/;
var m='';
eleName=eleName.replace('form_','');
eleName=eleName.replace('_',' ');
if(regE.test(eleVal)==true)
m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
return m;
}
</script>