Loading a dropdown list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mybytesusername
    New Member
    • Apr 2008
    • 1

    Loading a dropdown list

    Hi,

    I have 2 dropdown lists with category and subcategory details. If i change the category selection then the corresponding subcategory details should get loaded in the 2nd drop down list.how can i achieve this using javascript

    Please help me ASAP.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by mybytesusername
    Hi,

    I have 2 dropdown lists with category and subcategory details. If i change the category selection then the corresponding subcategory details should get loaded in the 2nd drop down list.how can i achieve this using javascript

    Please help me ASAP.
    If both values (for the lists) are coming from a database, then there are two approaches.

    1.) Use AJAX to load the second dropdown
    2.) Preload all the values from both lists into an array/arrays and then use Javascript to poulate the second list.
    Number (2) is bad because it does not cater for changes made to the lists after the page is loaded. It keeps using the data that was in the database when the page was first loaded.

    Comment

    Working...