Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Country list ComboBox

    Hi,

    I am all day long searching but can't find one.I am newbie in making menus.I want to make a dropdown menu box which list country names when we select a country it must open provinces or states in another combo box without loading the whole page.Please help needed urgent.

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    Search a search engine for "dynamically changing drop down"

    Sometimes it's as simple as typing in exactly what you want...

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You will need to use Ajax calls for populating the additional lists. The country dwopdown will have about 250 entries in it to start with. The provinces/states one will have thousands of values to select from depending on the country selected and so a retrieval from the server of just those for the selected country will be way more efficient than including them all in the code.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Can you please share the code here to do this trick ?

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    I don't have a completed solution built for you but these should get you started.

    First you need a country selection dropdown which you can create using my form at:
    http://javascript.about.com/library/blcountry.htm

    For the basic code to populate s second dropdown based on the selected entry in the first see:
    http://javascript.about.com/library/bldydrop1.htm

    For some introductory tutorials on how to retrieve values dynamically from the server see:
    http://javascript.about.com/od/learnajax/Learn_AJAX.htm
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #6
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    have u tried using dojo tookit for creating a combo box this will allow text entry and auto complete (works the same as the one in ms access database) also this is as easy as setting up a normal dropdown box.

    Dojo Toolkit check out the 0.4.3 version this was the best version for examples.


  •  

    Posting Permissions

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