First of all,thank you for your helps. I tried this piece of code alone, it works fine. Unfortunately when I added validation code into another ASP page (which is working alone also), the program give me runtime error saying it expected ')'. I took this whole moring, still not fixed. I changed the vbscript code into Javascript, more troubles.
One thing which still confusing me is some code (which is working well) does not work any more when I added some other codes in it.
Please check my code, and help me to fix it. It almost drove me crazy. Thank you very much.
Haijun
<HTML>
<HEAD>
<script language="VBScript">
function ProcedureData_onSubmit
if not(isdate(document.ProcedureData.dateofProc.value)) then
msgbox "not a correct date format", 1
ProcedureData_onSubmit = false
else
ProcedureData_onSubmit = true
end if
</Script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var BehavioralArray = new Array("('Select Procedure','',true,true)",
"('Depression, Major')",
"('Family Counseling')",
"('Family Management')",
"('Generalized Anxiety Disorder')",
"('Individual Consultation')",
"('Panic Disorder')",
"('Psychosis, Acute')",
"('Suicide Tendency')"

;
var GYNMArray = new Array("('Select Procedure','',true,true)",
"('Abnormal PAPs')",
"('Dysfunctional Uterine Bleeding')",
"('Ectopic pregnancy')",
"('Endometrial cancer')",
"('Infertility')",
"('PID')",
"('Sexual assault')",
"('Trauma of reproductive system')"

;
var GYNPArray = new Array("('Select Procedure','',true,true)",
"('Bartholin Duct Cyst Aspiration')",
"('Bartholin Duct Cyst Marsupialization')",
"('BTL')",
"('Cervical Biopsy')",
"('Colposcopy')",
"('Cryotherapy')",
"('Diaphragms Fitting ')",
"('Dilation Curettage')",
"('Ectopic management')",
"('Endometrial Biopsy')",
"('IUD placement')",
"('IUD removal')",
"('Leep')",
"('Polypectomy')",
"('Subcutaneous Contraception Implant')",
"('Subcutaneous Contraception Removal')",
"('Transvaginal USG')",
"('Vulvar Lesion Biopsy')"

;
var MedicineDArray = new Array("('Select Procedure','',true,true)",
"('Acute Abdomen')",
"('Acute Myocardial Infarction')",
"('Acute Renal Failure(Medicine DX/Pro)')",
"('AIDS')",
"('Asthma Exacerbation')",
"('CCU-ICU Management')",
"('Congestive Heart Failure')",
"('Deep Venous Thrombosis')",
"('Diabetic Ketoacidosis Management')",
"('Gastrointestinal Bleeding')",
"('Pulmonary Edema')",
"('Pulmonary Embolus')",
"('Sepsis (Medicine DX/Pro)')",
"('Shock')",
"('Stroke')",
"('Thyroid Storm (Acute thyrotoxicosis)')"

;
var MedicinePArray = new Array("('Select Procedure','',true,true)",
"('Arterial Line Placement')",
"('Central Line Placement')",
"('Flexible Sigmoidoscopy')",
"('Lumbar Puncture')",
"('Paracentesis')",
"('Stress Test ECG')",
"('Thoracentesis')"

;
var OBDArray = new Array("('Select Procedure','',true,true)",
"('1st trimester ultrasound')",
"('2nd trimester ultrasound')",
"('3rd trimester ultrasound')",
"('Bleeding in the first trimester')",
"('Bleeding in the second trimester')",
"('Bleeding in the third trimester')",
"('Breastfeeding counseling')",
"('Chorioamnionitis')",
"('Postpartum Fever')",
"('Postpartum Hemorrhage')",
"('Pregnancy-Induced Hypertension')",
"('Premature Rupture of Membranes')",
"('Preterm Labor')",
"('Resuscitation')",
"('Shoulder Dystocia')",
"('Urinary Tract Infection in Pregnancy')"

;
var OBPArray = new Array("('Select Procedure','',true,true)",
"('Amniotomy')",
"('Episiotomy ')",
"('Forceps delivery')",
"('IUPC placement')",
"('Labor Induction')",
"('Normal vaginal delivery')",
"('Oxytocin for augumentation of labor')",
"('perineal laceration repair')",
"('Placement of fetal scalp electrode')",
"('vacuum delivery')"

;
var OrthopedicsArray = new Array("('Select Procedure','',true,true)",
"('Arthrocentesis Injection')",
"('Carpal Tunnel Injury')",
"('Casting')",
"('Closed Colles Fracture with Manipulation')",
"('Closed Colles Fracture without Manipulation')",
"('Compound Fracture with Surgery')",
"('Debride (Orthopedics)')",
"('Dislocation')",
"('Ganglion Cyst - Aspiration')",
"('Ortho - Other')",
"('Shoulder Immobilization')"

;
var PediatricsNArray = new Array("('Select Procedure','',true,true)",
"('ABGs (Pediatric/Neonatal)')",
"('Chest Tube (Pediatric/Neonatal)')",
"('Circumcision (Pediatric/Neonatal)')",
"('CPR (Pediatric/Neonatal)')",
"('Exchange Transfusion (Pediatric/Neonatal)')",
"('IV Place (Pediatric/Neonatal)')",
"('LP (Pediatric/Neonatal)')",
"('PED/NEO - Other (Precedural)')",
"('Supra Pub Bld Aspiration (Pediatric/Neonatal)')",
"('UmbilCath -A (Pediatric/Neonatal)')",
"('UmbilCath -V (Pediatric/Neonatal)')",
"('Venipuncture (Pediatric/Neonatal)')"

;
var SurgeryArray = new Array("('Select Procedure','',true,true)",
"('Appendectomy')",
"('Biopsy/Skin-Excision')",
"('Biopsy/Skin-Punch-Shave')",
"('Chalazion Excision')",
"('Cryotherapy Treatment - Warts')",
"('Debridement')",
"('Foreign Body Removal')",
"('Foreign Body Removal-Eye')",
"('Hemorrhoid Banding')",
"('Hickman Catheter')",
"('Incision and Drainage - Other')",
"('Incision and Drainage - PeriRectal')",
"('Incision and Drainage - Pilonidal')",
"('Laceration - Complex')",
"('Laceration - Eyelid')",
"('Laceration - Simple')",
"('Nail Removal')",
"('Surg - Other')",
"('Trauma, Head')",
"('Trauma, Multiple')",
"('Unlisted Procedure')",
"('Vasectomy')"

;
function populateProcedure(inForm,selected) {
var selectedArray = eval(selected + "Array"

;
while (selectedArray.length < inForm.Procedure.options.length) {
inForm.Procedure.options[(inForm.Procedure.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.Procedure.options
=" + "new Option" + selectedArray);
}
if (inForm.Category.options[0].value == '') {
inForm.Category.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0);
}
}
}
}
}
function populateUSstate(inForm,selected) {
var stateArray = new Array("('Select State','',true,true)",
"('Alabama')",
"('Alaska')",
"('Arizona')",
"('Arkansas')",
"('California')",
"('Colorado')",
"('Connecticut')",
"('Delaware')",
"('Columbia')",
"('Florida')",
"('Georgia')",
"('Hawaii')",
"('Idaho')",
"('Illinois')",
"('Indiana')",
"('Iowa')",
"('Kansas')",
"('Kentucky')",
"('Louisiana')",
"('Maine')",
"('Maryland')",
"('Massachusetts')",
"('Michigan')",
"('Minnesota')",
"('Mississippi')",
"('Missouri')",
"('Montana')",
"('Nebraska')",
"('Nevada')",
"('New Hampshire')",
"('New Jersey')",
"('New Mexico')",
"('New York')",
"('North Carolina')",
"('North Dakota')",
"('Ohio')",
"('Oklahoma')",
"('Oregon')",
"('Pennsylvania')",
"('Rhode Island')",
"('South Carolina')",
"('South Dakota')",
"('Tennessee')",
"('Texas')",
"('Utah')",
"('Vermont')",
"('Virginia')",
"('Washington')",
"('West Virginia')",
"('Wisconsin')",
"('Wyoming')"
;
if (selected == 'USA') {
for (var i=0; i < stateArray.length; i++) {
eval("inForm.Procedure.options=" + "new Option" + stateArray);
}
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0)
}
else {
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0)
}
}
}
}
else {
}
if (selected == 'Other') {
newProcedure = "";
while (newProcedure == ""
{
newProcedure=prompt ("Please enter the name of your Procedure.", ""
;
}
if (newProcedure != null) {
inForm.Procedure.options[(inForm.Procedure.options.length-1)]=new Option(newProcedure,newProcedure,true,true);
inForm.Procedure.options[inForm.Procedure.options.length]=new Option('Other, not listed','Other');
}
}
if(inForm.Procedure.options[0].text == 'Select Procedure') {
inForm.Procedure.options[0]= null;
}
}
// End -->
</script>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY bgcolor=GreenYellow>
<form Name="ProcedureData" method=post onSubmit="return ProcedureData_onSubmit()">
<TABLE WIDTH=60% BORDER=1 CELLSPACING=1 CELLPADDING=1 align=center
bgcolor=LightSkyBlue>
<TR>
<TD>Date of Procedure</TD>
<TD><INPUT type="text" id=text1 name=DateofProc value ="<%= session("DateofProc"
%>" size="40"></TD>
</TR>
<script language=JScript>
document.ProcedureData.DateofProc.Value="1/1/1999"
</script>
<TR>
<TD><b>Resident Information</b></TD>
<TD></TD>
</TR>
<TR>
<TD>Resident Name</TD>
<TD><SELECT size=1 id=select1 name=ResidentName VALUE="<%= session("ResidentName"
%>" >
<OPTION>?</OPTION>
<OPTION>Cardarelli, Robert</OPTION>
<OPTION>De Leon, Berta</OPTION>
<option>Lee, William</option>
</SELECT></TD></TR>
<TR>
<TD>Rotation Location</TD>
<TD><SELECT size=1 id=select2 name=Rotation VALUE="<%= session("Rotation"
%>">
<option>?/option>
<option>Family Medicine In-patient Service 3--NW</option>
<option>Family Medicine Orientation</option>
<option>Family Practice Center--BFM</option>
<option>Family Practice Center--Kelsey-Seybold</option>
<option>Family Practice Center--Northwest</option>
<option>Family Psychology</option>
<option>General Medicine Wards</option>
<option>General Surgery</option>
<option>Geriatric - Nursing Home</option>
<option>Geriatrics--Outpatient</option>
<option>Gynecology</option>
<option>Medical Intensive Care Unit</option>
<option>Neonatology</option>
<option>Neurology</option>
<option>Obstetrics Triage</option>
<option>Obstetrics--Night Call</option>
<option>Obstetrics--Night Call & Obstetrics Triage</option>
<option>Ophthalmology</option>
<option>Orthopedics</option>
<option>Pediatric ER</option>
<option>Pediatric Sub-specialty</option>
<option>Pediatric Ward</option>
<option>Pediatrics, Ambulatory</option>
<option>Pediatrics, Inpatient</option>
<option>Sports Medicine</option>
<option>Surgery ER</option>
<option>Urology</option>
<option>Women's Health--Gyn</option>
<option>Women's Health--OB</option>
<option>Women's Health--OB/Gyn</option>
</SELECT></TD>
</TR>
<TR>
<TD><b>Patient information</b></TD>
<TD></TD>
</TR>
<TR>
<TD>Patient First Name</TD>
<TD><INPUT type="text" id=text4 name=PtFirstName VALUE="<%= session("PtFirstName"
%>"></TD>
</TR>
<TR>
<TD>Patient Last Name</TD>
<TD><INPUT type="text" id=text2 name=PtLastName VALUE="<%= session("PtLastName"
%>" ></TD>
</TR>
<TR>
<TD>Date of Birth</TD>
<TD><INPUT type="text" id=text3 name=DOB VALUE="<%= session("DOB"
%>"></TD>
</TR>
<TR>
<TD>Sex</TD>
<TD><SELECT size=1 id=select3 name=Sex VALUE="<%= session("Sex"
%>">
<option>?/option>
<OPTION>Male</OPTION>
<OPTION>Female</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD>Location</TD>
<TD><SELECT size=1 id=select4 name=Location VALUE="<%= session("Locatioin"
%>">
<option>?/option>
<OPTION>Seven Acres Nursing Home</OPTION>
<OPTION>Advance Credit Given</OPTION>
<OPTION>Antoine Clinic</OPTION>
<OPTION>Baylor Family Medicine</OPTION>
<OPTION>Ben Taub General Hospital</OPTION>
<OPTION>Casa de Amigos</OPTION>
<OPTION>Gulfgate Health Center</OPTION>
<OPTION>MLK Health Center</OPTION>
<OPTION>Northwest Health Center</OPTION>
<OPTION>People's Health Center</OPTION>
<OPTION>Strawberry Health Center</OPTION>
<OPTION>International</OPTION>
<OPTION>Kelsey Seybold</OPTION>
<OPTION>The Lord of the Streets</OPTION>
<OPTION>M.D. Anderson Cencer Center</OPTION>
<OPTION>Methodist Hospital</OPTION>
<OPTION>Nursing Home--Other</OPTION>
<OPTION>Private Practice</OPTION>
<OPTION>Quentin Meese</OPTION>
<OPTION>Rural Practice</OPTION>
<OPTION>S.E.A.R.C.H. Homeless Clinic</OPTION>
<OPTION>Saint Luke's Episcopal Hospital</OPTION>
<OPTION>Star of Hope</OPTION>
<OPTION>Texas Childrens' Hospital</OPTION>
<OPTION>Thomas Street Clinic</OPTION>
<OPTION>Veterans Affairs Medical Center</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD>Medical Record No</TD>
<TD><INPUT type="text" id=text5 name=MedRedNo VALUE="<%= session("MedRedNo"
%>"></TD>
</TR>
<TR>
<TD>continuity Patient</TD>
<TD><INPUT type="checkbox" id=checkbox1 name=Continuity VALUE="<%= session("Continuity"
%>"></TD>
</TR>
<TR>
<TD><B>Procedure Information</B></TD>
<TD></TD>
</TR>
<TR>
<TD>Category</TD>
<TD><select name="Category" onChange="populateProcedure(document.ProcedureData,document.ProcedureData.Category.options[document.ProcedureData.Category.selectedIndex].value)">
<option selected value=''>Select Category</option>
<option value='Behavioral'>Behavioral Science</option>
<option value='GYNM'>GYN Management</option>
<option value='GYNP'>GYN Procedures</option>
<option value='MedicineD'>Medicine Diagnosis</option>
<option value='MedicineP'>Medicine Procedures</option>
<option value='OBD'>OB Diagnosis/Management</option>
<option value='OBP'>OB Procedures</option>
<option value='Orthopedics'>Orthopedics</option>
<option value='PediatricsN'>Pediatrics/Neonatal</option>
<option value='Surgery'>Surgery</option>
</select></TD>
<TR>
<TD>Procedure</TD>
<TD><select name="Procedure" onChange="populateUSstate(document.ProcedureData,document.ProcedureData.Procedure.options[document.ProcedureData.Procedure.selectedIndex].text)">
<option value=''><--------------------</option>
</select></TD>
</TR>
<TR>
<TD>Involment</TD>
<TD><SELECT size=1 id=select7 name=Involvement VALUE="<%= session("Involvement"
%>">
<option>?/option>
<OPTION>Assisted</OPTION>
<OPTION>Performed</OPTION>
<OPTION>Supervised</OPTION>
<OPTION>Independent Performance</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD>Topic category</TD>
<TD><SELECT size=1 id=select8 name=TopicCategory VALUE="<%= session("TopicCategory"
%>">
<option>?/option>
<OPTION>New Problem</OPTION>
<OPTION>Check-up</OPTION>
<OPTION>Chronic Illness</OPTION>
<OPTION>Psychological</OPTION>
<OPTION>Behavior Change</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD>Did you follow the TOPIC model?</TD>
<TD><INPUT type="checkbox" id=checkbox2 name=didYouFollowTheTopicModel VALUE="<%= session("didYouFollowTheTopicModel"
%>"></TD>
</TR>
<TR>
<TD>Supervisor</TD>
<TD><INPUT type="text" id=text6 name=Supervisor VALUE="<%= session("Supervisor"
%>"></TD>
</TR>
<TR>
<TD>Other information</TD>
<TD><TEXTAREA rows=2 cols=20 id=textarea1 name=OtherInfo VALUE="<%= session("OtherInfo"
%>">
</TEXTAREA></TD>
</TR>
<TR>
<TD>Faculty in charge</TD>
<TD><INPUT type="text" id=text7 name=FacultyIncharge VALUE="<%= session("FacultyInCharge"
%>"></TD>
</TR>
<TR>
<TD>Observed by</TD>
<TD><SELECT size=1 id=select9 name=ObservedBy VALUE="<%= session("ObservedBy"
%>">
<option>?/option>
<OPTION>Faculty Memeber</OPTION>
<OPTION>Upper Level Resident</OPTION>
<OPTION>Other</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD>Comments</TD>
<TD><TEXTAREA rows=2 cols=20 id=textarea2 name=Comments VALUE="<%= session("Comments"
%>">
</TEXTAREA></TD>
</TR>
<TR>
<TD>Other procedure?</TD>
<TD><INPUT type="checkbox" id=checkbox3 name=AotherProcedure VALUE="<%= session("AnotherProcedure"
%>"></TD>
</TR>
<TR>
<TD><INPUT type="submit" value="Submit Your Procedure" id=submit1 name=submit1></TD>
<TD><INPUT type="reset" value="Reset" id=reset1 name=reset1></TD>
</TABLE>
</form>
</BODY>
</HTML>