Because you are defining a variable locationChoice, you can also use that
variable in your "if" statement like shown below.
Sent: Monday, March 05, 2001 9:24
AM
Subject: Select Alert Popup
I am
sure that I am missing something very basic here. What I want to do is when a
user selects an element in the following select list they are presented with a
popup that tells them how many digits they have to enter in the patient
account number field. What is happening is I am getting the same message all
of the time. So when I select a facility that only uses 7 digits, I want the 7
digit message to appear. What I am getting is the 8 digit
message.
Here
is the code:
<script language="JavaScript1.2"
type="text/javascript">
<!--
function sendAlert()
{
locationChoice = testForm.entityselectedIndex
if
(testForm.entity.options[locationChoice].value = "BUMC")
{
alert("Please enter an 8 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "Landry Center")
{
alert("Please enter an 8 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "Grapevine")
{
alert("Please enter a 7 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "Garland")
{
alert("Please enter a 7 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "BIR")
{
alert("Please enter a 7 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "Irving")
{
alert("Please enter a 7 digit patient account
number")
return false
}
if
(testForm.entity.options[locationChoice].value = "Ellis")
{
alert("Please enter a 7 digit patient account
number")
return
false
}
}
//-->
</script>
<body>
<form name="testForm" method="post"
action="test.cfm">
<select name="entity"
onchange="sendAlert(this)">
<option value="">---Select
One ---
<option
value="BUMC">BUMC
<option value="Landry Center">Landry
Center
<option
value="Grapevine">Grapevine
<option
value="Garland">Garland
<option
value="BIR">BIR
<option
value="Irving">Irving
<option
value="Ellis">Ellis
</select>
<BR>
<input
type="Submit" value="Submit">
</form>
thanks,
Bruce Sorge
Portal Services
Baylor Health Care
Systems
Phone: 214-820-3142
---
Outgoing mail is certified Virus Free.
Checked by AVG
anti-virus system (
http://www.grisoft.com).
Version: 6.0.231
/ Virus Database: 112 - Release Date: 2/12/2001