View Full Version : auto-select comboboxes

08-19-2005, 04:11 PM
i've searched everywhere but i cant quite find what im looking for i hope some1 here can help me...

ok so im making two forms, one that contains mostly comboboxes and loads all its contents from different tables in an SQL db and when the user submits it send the information to an independant table. Another form that also contains mostly comboboxes (and some comboboxes are the same as the first form, only like 2) is supposed to have an "optional" combobox that when the user selects an option, all the comboboxes that are the same as the first form automatically select the same option as they chose on the first form. this is used to save time, i really dont get it since it's only 2 comboboxes but my tutor sais it has to be that way so...

Anyway i know it's made with the "onchange event" on the optional combobox and that it could be done with a javascript but problem is i dont know js (i've been working the whole page with ASP in vb script), but i sorta understand it xD. Also the way this works is that the user is given an Event ID on the first form so when they go to the second form they just select the event id on the optional combobox and the combos are filled.

So i hope some1 can point me the right way here, thanks in advance :)

Brett Bretterso
08-19-2005, 04:56 PM
Here's a good javascript tutorial for beginners.


What you'll have to do is have the asp write their answers from the first form into javascript variables. Then like your tutor said, have the one combobox with an onchange javascript function that loads the data from those variables into the form.

Another way you could do it is without javascript. Just make it so the second form automatically posts back to itself when they change that one combobox. Then have the asp load the data when it sees the value of that combobox. I haven't done regular asp (I do asp.net now) in a while so I don't remember the code to do it, but that's the basic idea. Many might say this way would be preferable because then you wouldn't have to worry about people that have javascript disabled.

Anyway, that's my two cents.

Brett Bretterson

08-19-2005, 09:11 PM
As this thread is cross posted in the ASP forum (http://www.codingforums.com/showthread.php?t=66300), closing thread. Please don't post the same question in multiple forum categories.