From a2b7c3effc2dc5b9546a4dbf86112afe2625b070 Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Mon, 15 Jun 2009 17:44:55 +0000 Subject: [PATCH] allow only alphanumeric characters in policy numbers --- interface/patient_file/summary/demographics_full.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/interface/patient_file/summary/demographics_full.php b/interface/patient_file/summary/demographics_full.php index 034bab15d..ba2fb2f2a 100644 --- a/interface/patient_file/summary/demographics_full.php +++ b/interface/patient_file/summary/demographics_full.php @@ -256,7 +256,21 @@ function submitme() { f.submit(); } } - + +// Onkeyup handler for policy number. Allows only A-Z and 0-9. +function policykeyup(e) { + var v = e.value.toUpperCase(); + for (var i = 0; i < v.length; ++i) { + var c = v.charAt(i); + if (c >= '0' && c <= '9') continue; + if (c >= 'A' && c <= 'Z') continue; + v = v.substring(0, i) + v.substring(i + i); + --i; + } + e.value = v; + return; +} + // Added 06/2009 by BM to make compatible with list_options table and functions - using jquery $(document).ready(function() { @@ -461,7 +475,8 @@ end_group(); : - policy_number value=""> + " + onkeyup='policykeyup(this)'> -- 2.11.4.GIT