www.webdeveloper.com
Results 1 to 4 of 4

Thread: will Ajax allow me to do this?

  1. #1
    Join Date
    Jul 2009
    Posts
    77

    Question will Ajax allow me to do this?

    I have a question about how Ajax-powered dropdowns could work...

    If I have a drop-down list of companies, a drop-down list of states/provinces, and a drop-down list of cities, and I want to be able to filter records in a database based on those dropdowns, could I let a user choose any item from any of the three dropdowns (ex. they could choose a city, a company, or a state/province) and use ajax to repopulate the other remaining two dropdown lists?

    So if they chose a city, then the state/province dropdown would repopulate to the respective state/province where that city is, and the company dropdown would repopulate to only companies that are in that city?

    Is that possible? Or is it necessary to define a hierarchy or order to the series of filters?

    Does anyone have an example of something like this?

  2. #2
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,266
    You can see Changing Select element content on the fly and use Dynamically removing an external JavaScript or CSS file. It's probably better to build javascript files with PHP. Here is an exemple for France (which 36 685 cities in about 100 counties an 23 regions).

  3. #3
    Join Date
    Jul 2009
    Posts
    77
    Yeah, I get that... maybe this is a better explanation of what I'm having a hard time with:

    Take the following link for example: http://www.asp.net/ajax/ajaxcontrolt...gDropDown.aspx

    There are a series of 3 different drop down menus: MAKE, MODEL, COLOR. In this series, selecting a MAKE populates the MODEL dropdown, which in turn populates the COLOR drop down. You MUST choose a MAKE first... What I want to do is make 3 dropdowns where it doesn't matter what order you select them in..

    So if we choose 'champagne-silver' under COLOR, the other two drop down menus would repopulate so they would show all of the MAKEs that have vehicles in that color, and the MODEL menu would be repopulated with all of the MODELs (from all the MAKES) that are available in that color..

    Does that make sense? Is that possible?

  4. #4
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,266
    Yes it make sense. It'is possible to choose shorter lists with javascript...

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