If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Multiple Listbox

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-03, 07:37
johnan johnan is offline
Registered User
 
Join Date: Aug 2003
Posts: 7
Multiple Listbox

Hi, I need help on creating multiple dropdown lists.
Example:
I have a first listbox with values Group and Individual.
If a user selects Group then another listbox will appear with values that I get from a table named Group in the database.
And if the user chooses Individual, the other listbox will appear with values from a table named Users in the database.

Can anyone help?
Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 08-21-03, 10:59
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Group, Individual... sounds like insurance

There are two ways to accomplish this. Both ways require an "onChange" on the first list box. When the individual selects from the drop down, onChange is fired.

The first method uses that JavaScript in onChange to submit the form back to itself, and then executes ASP to populate the second list box (basically refreshing the form with the second listbox populated with the values based upon the selection on the first listbox).

The second method, if you want to hide the page reload from the user, is to do this with IFrame in a hidden SPAN or DIV. When that onChange is fired, you change the URL of the IFrame to the address of an ASP page that will generate JavaScript to update the parent window's listbox (remember to attach some QueryString params to the new URL, or your ASP won't know what values get populated). This approach then makes it "seamless", but requires a bit more work, especially if this needs to be cross browser compliant.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On