From 453804413d69a9e7296833d04a71054af1e9dccd Mon Sep 17 00:00:00 2001 From: bradymiller Date: Fri, 19 Feb 2010 02:32:39 +0000 Subject: [PATCH] bug fix: validate to ensure a prescription is selected, by dle5400, tracker artifact 2941804 --- templates/prescription/general_list.html | 38 +++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/templates/prescription/general_list.html b/templates/prescription/general_list.html index 8e3644a7c..f05d894ad 100644 --- a/templates/prescription/general_list.html +++ b/templates/prescription/general_list.html @@ -27,12 +27,43 @@ function changeLinkHref(id,addValue,value) { } } +var CheckForChecks = function(chk) { + // Checks for any checked boxes, if none are found than an alert is raised and the link is killed + if (Checking(chk) == false) { return false; } + return top.restoreSession(); +}; + +function Checking(chk) { + var len=chk.length; + var foundone=false; + + if (len==undefined) { + if (chk.checked == true){ + foundone=true; + } + } + else { + for (pr = 0; pr < chk.length; pr++){ + if (chk[pr].checked == true) { + foundone=true; + } + } + } + if (foundone) { + return true; + } else { + alert("{/literal}{xl t='Please select at least one prescription!'}{literal}"); + return false; + } +} + {/literal}
+
+ @@ -78,7 +110,7 @@ function changeLinkHref(id,addValue,value) { {$prescription->provider->get_name_display()} {foreachelse} @@ -87,12 +119,16 @@ function changeLinkHref(id,addValue,value) { {/foreach}
{xl t='Drug'} {xl t='Created'}
{xl t='Changed'}
- +
+
{literal}