www.webdeveloper.com
Results 1 to 3 of 3

Thread: Drop down list 2 with changing values acc. to drop down list 1

  1. #1
    Join Date
    Feb 2011
    Posts
    24

    Drop down list 2 with changing values acc. to drop down list 1

    I don't know whether it is possible but in an ideal world I would like to do the following:

    Select a departure point A, B, C, D from a drop down list 1 (so far, so good, I can do that!)

    If departure point is A or B only show arrival points 5, 6, 7 and 8 in drop down box 2.

    If departure point is C or D only show arrival points 1, 2, 3, 4 in drop down box 2.

    Somehow these values should be in my html form but I presume there should be some javascript function called, once the first selection is made in drop down box 1??

    I would appreciate any help or advice.

    Thanking you in advance.

  2. #2
    Join Date
    Oct 2012
    Posts
    4
    Basically you have javascript run a function, onchange (the select box) it checks a javascript array and replaces the values of that box with the array values.. Since I'm sure you aren't too well versed just search on google "javascript dynamic select box" or if you use jquery/ajax.. Try looking at this

    http://remysharp.com/2007/01/20/auto...g-jquery-ajax/

    You can also do it without jquery/ajax.. but yeah lots of places do it, and it's not too difficult.

  3. #3
    Join Date
    Feb 2011
    Posts
    24
    Thank you Tos, that gives me some good indication of where to start. It looks fairly straightforward (famous last words!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles