Linked dropdowns

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sheldonlg

    Linked dropdowns

    I am still learning more of Javascript, so please bear with me.

    My objective is to have a dropdown list for categories. Depending upon
    what the user clicks, I want the subcategories dropdown to change
    content. I am sure this has been done many times and a pointer would be
    helpful. I googled, but didn't find anything (Maybe because I don't
    know the right keywords to use). The back end server code is in php, so
    an ASP solution is not viable.

    My idea is to attach and onchange to the category dropdown. Depending
    upon the value in that dropdown, I would read the contents of a file on
    the server and via innerHTML change the contents of the subcategory
    dropdown list. In my googling, all I seem to come up with is reading
    from the user's machine. These files would be on the server, so it
    really should be much easier, but I haven't found it.

    I know I can do this with php, however that involves either regenerating
    the page or using AJAX. I am looking to see if there is a straight
    javascript solution.

    BTW, if there is a better way I am totally open to suggestions.
  • sheldonlg

    #2
    Re: Linked dropdowns

    sheldonlg wrote:
    I am still learning more of Javascript, so please bear with me.
    >
    My objective is to have a dropdown list for categories. Depending upon
    what the user clicks, I want the subcategories dropdown to change
    content. I am sure this has been done many times and a pointer would be
    helpful. I googled, but didn't find anything (Maybe because I don't
    know the right keywords to use). The back end server code is in php, so
    an ASP solution is not viable.
    >
    My idea is to attach and onchange to the category dropdown. Depending
    upon the value in that dropdown, I would read the contents of a file on
    the server and via innerHTML change the contents of the subcategory
    dropdown list. In my googling, all I seem to come up with is reading
    from the user's machine. These files would be on the server, so it
    really should be much easier, but I haven't found it.
    >
    I know I can do this with php, however that involves either regenerating
    the page or using AJAX. I am looking to see if there is a straight
    javascript solution.
    >
    BTW, if there is a better way I am totally open to suggestions.

    I did it with an AJAX technique.

    Comment

    Working...