Dynamic Towns/Cities Help

Discussion in 'JavaScript' started by scottlpool2003, May 13, 2013.

  1. #1
    I have a database that contains the following data:

    - ID​
    - Postcode​
    - Eastings​
    - Northings​
    - Longitude​
    - Latitude​
    - Town​
    - Region​
    - County​
    - Country​

    I need my users to be able to select a region and then be shown corresponding towns and be able to select a town.

    The theme of the website is to upload publications and they need to be localized.

    The problem I'm encountering is what if a user has a publication in many regions and/or many towns?

    Is there anything I could do in Javascript to allow the user to select multiple regions/towns?

    Thanks.
     
    scottlpool2003, May 13, 2013 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    Yes you could do this.

    Use <select multiple="multiple" name="region1[]"></select> for each region form and increment the number by 1 for each region select field. Then just show a normal select menu for the town.
     
    HuggyStudios, May 13, 2013 IP
  3. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #3
    Thanks, I'm not overly familiar with JS. How would I show the corresponding town/s depending on region/s selected?

    Thanks again.
     
    scottlpool2003, May 14, 2013 IP
  4. modulout

    modulout Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    You will need ajax. Search for jQuery multiple dropdown. Something like: http://jqueryfordesigners.com/populate-select-boxes/
     
    modulout, May 14, 2013 IP