NewCrop E-Prescription Module.
[openemr.git] / library / erx_javascript.inc.php
blob5b5fc8f271c453c50b9f4b1727d0f01c7fe83a22
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 checkPhone(eleName,eleVal)
50 var regE = /[^0-9']/;
51 var m='';
52 eleVal_temp=eleVal.replace(/[^0-9]/ig,'');
53 eleVal=eleVal.replace(/[-)(\s]/ig,'');
54 eleName=eleName.replace('form_','');
55 eleName=eleName.replace('_',' ');
56 if(regE.test(eleVal)==true)
57 m += '<?php echo xl("Invalid non-numeric character in")." "?>'+eleName.toUpperCase()+"\n";
58 else if(eleVal_temp.length>10)
59 m += eleName.toUpperCase()+'<?php echo " ".xl("should contain only 10 digits") ?>'+"\n";
60 else if(eleVal_temp.length<10)
61 m += eleName.toUpperCase()+'<?php echo " ".xl("should contain 10 digits") ?>'+"\n";
62 return m;
65 function checkTaxNpiDea(eleName,eleVal)
67 var regE = /[^0-9]/;
68 var m='';
69 eleName=eleName.replace('_',' ');
70 if(regE.test(eleVal)==true)
71 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
72 return m;
75 function checkUsername(eleName,eleVal)
77 var regE = /[^a-zA-Z0-9_\-']/;
78 var m='';
79 eleName=eleName.replace('form_','');
80 if(regE.test(eleVal)==true)
81 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
82 return m;
85 function checkAlphaNumeric(eleName,eleVal)
87 var regE = /[^a-zA-Z0-9\s]/;
88 var m='';
89 eleName=eleName.replace('form_','');
90 eleName=eleName.replace('_',' ');
91 if(regE.test(eleVal)==true)
92 m += '<?php echo xl("Invalid character in")." " ?>'+eleName.toUpperCase()+"\n";
93 return m;
95 </script>