Click to See Complete Forum and Search --> : Populating Combobox


jithu_hai
April 24th, 2004, 09:36 AM
I'm creating an asp page, where i have two drop down list(<select>). i want to populate the drop down lists with the data from a database table. the second dropdownlist is to be filled
according to the selection in the first one. just like once i select the country, the states of
that country is to be fetched from the database and shown in the second dropdownlist. pls help to get this done.

tk_Sajesh
April 26th, 2004, 03:58 AM
hi Jithu,
U should have continued the earlier post in this forum titled ASP.
I have posted the code for a different scenario, which was asked by u there. By doing slight modifications in that u can attain the solution for current scenario.
Attached is the sample code for the same. Download the files & place them in ur virtual dir & execute it.
Incase of doubt mail me.
Sajesh

tk_Sajesh
April 26th, 2004, 04:00 AM
Ur file is attached and ready 2 sent...........

jithu_hai
April 29th, 2004, 09:07 AM
Thanks pal.You were of great help

jithu_hai
April 29th, 2004, 09:17 AM
Hi sajesh

I have a small doubt in the program u sent me( loading the values in the combobox.zip).I am submittting my form to another ASP form .Since ur code contains form.submit code. the form automatically submits itself when I click on the first combobox.The second file takes the values from the first form and run a query accordingly.So the submission must only happen on button click.How could i do this.Plz help me I am new to asp

tk_Sajesh
April 29th, 2004, 11:49 PM
hi Jithu,
Assuming that U r trying to automate some search functionality.
Inorder 2 make the form submit to 2 different URLs when 2 different events are fired, then u need 2 add the following piece of code.
1) Assign the forms action method as null

<form name="frmCmbChooser" method="post" action="">
2) Instead of submit button, add an ordinary button in ur page.
<input type="button" name="cmdSubmit" id="cmdSubmit" value="Submit" onClick="buttonClickEvent()">
3) Add the method buttonClickEvent() in the script section.

function buttonClickEvent(){
document.frmCmbChooser.action="Dynamic_Values_v1.0.asp"; // Second Page URL.
document.frmCmbChooser.submit();
}


This willd do the job 4 u.
Sajesh