Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Form selects changing

treshrtreshr Member Posts: 326
[b][red]This message was edited by treshr at 2005-11-7 6:27:33[/red][/b][hr]
I have the following problem. I want to create a form using two selects with several options.

One select holds the provinces of a country. The second one holds the cities.
The second only shows the cities when you select a certain province.

Can anybody give me a lead how to solve this problem.
I know that you have to have some kind of list containing all the cities and all the provinces but how do I put them together.
Do I have to use a database or something or can it just be done in javascript.

Thanx in advance,

--=][tReShR][=--


Comments

  • mac_doggiemac_doggie Member Posts: 488
    : I have the following problem. I want to create a form using two selects with several options.
    :
    : One select holds the provinces of a country. The second one holds the cities.
    : The second only shows the cities when you select a certain province.
    :
    : Can anybody give me a lead how to solve this problem. Do I have to use a database or something or can it just be done in javascript.
    :
    : Thanx in advance,
    :
    : --=][tReShR][=--
    :
    You can create a select with cities for each province and then hide or show it when that province is selected:

    [code]

    function setCities() {
    // first hide both selects...
    document.getElementById('utrecht').style.display = 'none';
    document.getElementById('noord-braband').style.display = 'none';
    // then show the selected one...
    document.getElementById(document.getElementById('province').value).style.display = 'block';
    }



    Choose province
    Utrecht
    Noord-Braband



    Utrecht
    De bilt
    Zeist
    Driebergen



    Eindhoven
    Tilburg
    Denbosch
    Best


    [/code]
    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • freeman_452003freeman_452003 Member Posts: 15
    Dood that's preety slick
  • treshrtreshr Member Posts: 326
    This script works perfectly, maybe you know this. Do you know a website where I can find any place in holland with it's province. I need to use this for my application.

    Thanx in advance.

    --=][tReShR][=--

  • freeman_452003freeman_452003 Member Posts: 15
    : This script works perfectly, maybe you know this. Do you know a website where I can find any place in holland with it's province. I need to use this for my application.
    :
    : Thanx in advance.
    :
    : --=][tReShR][=--
    :
    :
    -------------------------------

    try MSN Maps
  • treshrtreshr Member Posts: 326
    I already started using this script but do you also have a solution to this: The same kind of form but with all the select fields but than disables.
    So what I need is a form with 2 select statements en before somewhone select a province the places field is ddisabled.

    I found a few scripts but they usually don't work or are very hard to maintain.

    I hope you also have a solution to this.

    Thanx in advance.

    --=][tReShR][=--

Sign In or Register to comment.