|
|
#1 |
|
New Member
![]() Join Date: May 2011
Posts: 4
|
I have 3 folders named 100020, 123440, and 456987 all contain a general.htm that starts a separate lesson for my pharmacy students. I have a single text box form with a submit button
Code:
<form onsubmit="return handleThis(this)" name="patientfindform"> Any help would be appreciated. Code:
function handleThis(formElm)
/*{
window.location="http://www.mywebsite.com/echart/"+formElm.patient_num.value+"/general.htm";
return false;
}
*/
if (formElm.patient_num.value = 100020)
{
window.location="http://www.mywebsite.com/echart/"+formElm.patient_num.value+"/general.htm";
}
else if (formElm.patient_num.value = 123440)
{
window.location="http://www.mywebsite.com/echart/"+formElm.patient_num.value+"/general.htm";
}
else if (formElm.patient_num.value = 456987)
{
window.location="http://www.mywebsite.com/echart/"+formElm.patient_num.value+"/general.htm";
}
else
{
alert("Patient ID not found");
}
|
|
|
|
|
|
#2 |
|
Silver Member
![]() Join Date: Jul 2011
Posts: 146
|
You have made a very common Javascript beginner mistake. Here's a hint - check your if statement syntax. Actually, what you are doing would be better with a switch statement:
Code:
switch (formElm.patient_num.value) {
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|