SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple dynamically populated drop down selects?

    I'm looking to add a 'dynamic select' form to my site.

    Is there anything that gives the functionality of the following scenario; I have 3 drop down menus- make, model, year. I want the user to be able to select a make then the model drop down would populate with only models of that make, user selects a model and the years drop down would populate with only the years that that model were made? Any ideas?

    Thanks!

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,506
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Welcome to the SP forums.
    What you want can be done with AJAX. Try a search for it in this forum, or google for it.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kiqyou_vf View Post
    I'm looking to add a 'dynamic select' form to my site.

    Is there anything that gives the functionality of the following scenario; I have 3 drop down menus- make, model, year. I want the user to be able to select a make then the model drop down would populate with only models of that make, user selects a model and the years drop down would populate with only the years that that model were made? Any ideas?

    Thanks!
    If you're using jQuery library you can use something like:

    Code javascript:
    $('#make').change(function () {
        $('#model').load('getModels.php', {make: this.value});
        $('#year').empty();
    });
    Last edited by paul_wilkins; Feb 9, 2012 at 17:18.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Welcome to the SP forums.
    What you want can be done with AJAX. Try a search for it in this forum, or google for it.
    Thanks guido. Can you suggest some terms I might search for? I'm not quite sure what exactly this functionality/process is called. I'm hoping for there to be a simple plugin/snippet I'd be able to use.

  5. #5
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    If you're using jQuery library you can use something like:

    Code javascript:
    $('#make').change(function () {
        $('#model').load('getModels.php', {make: this.value});
    });
    Hey I've got a friend who just moved to Christchurch (from Iowa, US). Small world.

    Thanks for the info, but unfortunately my JS skills are null. Would you suspect it would take a skilled JS dev much time to assemble this functionality, if I had to end up contracting this out?

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kiqyou_vf View Post
    Hey I've got a friend who just moved to Christchurch (from Iowa, US). Small world.

    Thanks for the info, but unfortunately my JS skills are null. Would you suspect it would take a skilled JS dev much time to assemble this functionality, if I had to end up contracting this out?
    It wouldn't take much time at all. The toughest part would be creating the database to contain all of the data.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •