Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003

    Unanswered: Multiple Listbox

    Hi, I need help on creating multiple dropdown lists.
    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.

  2. #2
    Join Date
    Jul 2003
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts