PDA

Click to See Complete Forum and Search --> : Javascript Question


winapi
Jun 17th, 2000, 06:41 AM
Hi,
I know this is the wrong section to be asking this question , but I usually get someone that knows what there talking about here. Lets say I have two HTML select boxes. Depending on the selection on the first one, I would like to populate the second with other information from a database. Can anyone write me a simple script on how to do this.


Thanks
Richard

Clunietp
Jun 18th, 2000, 02:49 AM
do you want the page to refresh before the 2nd combo box is populated?

winapi
Jun 18th, 2000, 02:57 AM
If at all possible, no. I cannot figure out how to write SUBs in coldfusion so that will probably be impossible. I can make it work with refreshing the page, but the database entries are soooo large I didn't want to reload them every time.

Clunietp
Jun 18th, 2000, 03:00 AM
how much data will have to be sent to the second combo box? If you need to send 100000 records to your page to account for all possibilities for combo box #1, that is not good.....plus the javascript is a bit complicated to dynamically populate the second combo box

winapi
Jun 18th, 2000, 03:28 AM
What would be really cool is if I could call ColdFusion code inside the Javascript function. Does anyone know how to do that???

Clunietp
Jun 18th, 2000, 03:34 AM
from what I understand about cold fusion, it is like ASP.

ASP is executed on the server, while Javascript is executed on the client. You can't execute ASP script without a page refresh (well, you sort-of can with remote scripting or maybe even frames....)

highlife
Jun 19th, 2000, 10:49 PM
if you are only pulling out a few records from the db for each selection, you could load each record set into a javascript array.

and then when the selection on the first box is made you could then have a function that changes the select.value of the 2nd box via the arrrays based on the selectedIndex of the first box