Results 1 to 4 of 4

Thread: dependent dropdown boxes in form

  1. #1
    DickTracy is offline Newbie Net Builder
    Join Date
    Dec 2008
    Posts
    116
    Thanks
    12
    Thanked 19 Times in 12 Posts

    dependent dropdown boxes in form

    I'm hoping someone can point me in the right direction - I've been searching for ages with no success and haven't really much idea where to look:

    I have a form with two drop-down boxes, where the content of the second needs to be dependent on the option chosen in the first

    eg if the first dropdown box is 'countries' and the second is 'states', and the user chooses USA in the first dropdown box, they should only see USA states in the second box.

    There isn't a high number of choices available to the user so the detail can be in a database or in the file itself with no problem.

    All pointers where I start are very welcome

    Cheers

  2. #2
    elbandelero's Avatar
    elbandelero is offline Net Builder
    Join Date
    Dec 2008
    Location
    Spain
    Posts
    544
    Thanks
    209
    Thanked 106 Times in 80 Posts
    Just doing a quick Google I found an example using javascript that looks scalable for your purposes.

    Felgall Javascript - Dynamic Dropdown Boxes

  3. Thanked by:

    DickTracy (30 January, 2009)

  4. #3
    DickTracy is offline Newbie Net Builder
    Join Date
    Dec 2008
    Posts
    116
    Thanks
    12
    Thanked 19 Times in 12 Posts
    Aaah, I was seraching for ages, don't know how you found that so quickly.
    Looks good - I'll give it a go.

    php would be even better because it could return options for the second box only when the query has results (in this case, when holiday rentals of a certain size actually exist for the country / states chosen) but this looks like a good 'second best'.

    Cheers

    edit: actually I can use PHP queries within the javascript code to achieve that, so should work fine

  5. #4
    elbandelero's Avatar
    elbandelero is offline Net Builder
    Join Date
    Dec 2008
    Location
    Spain
    Posts
    544
    Thanks
    209
    Thanked 106 Times in 80 Posts
    lol, I searched for "javascript dependent drop down form"

Similar Threads

  1. Dropdown Menus in WordPress
    By vectro in forum Blogging
    Replies: 6
    Last Post: 18 May, 2011, 02:57 AM
  2. How Many Low End VPS boxes do you have?
    By Coastercraze in forum Web Hosting
    Replies: 0
    Last Post: 7 December, 2010, 02:54 AM
  3. Help with dropdown menu code
    By tmongy in forum Web Design
    Replies: 9
    Last Post: 13 May, 2010, 16:34 PM
  4. Shipping boxes...
    By moonpeach in forum Business
    Replies: 5
    Last Post: 15 August, 2009, 23:05 PM
  5. Ads in designed boxes?
    By mixke in forum AdSense
    Replies: 7
    Last Post: 8 March, 2009, 00:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

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