469,326 Members | 1,601 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

Passing Variables to Drop Down Menu

Hello;

I never coded in javascript but I taught myself perl through books and tutorials and found many similarities.

This helped me modify a free downloadable javascript snippet of code from a website and do the nessessary changes to adapt it to my needs.

http://javascript.internet.com/forms/country-state-drop-down.html

I need a drop down menu for a registration form where people select states from a menu and automatically will load cities from that state in the following drop down menu.

Well.. the script I found does the same thing except instead of selecting a state to find a city it shows how to select a country to find a state.

What I added on my own is placing a country drop down menu above it to have the option of selecting the following:

1) El Salvador (where I live)
2) USA
3) Any other country

The default value is to load El Salvador with its states and cities.

When one selects OTHER COUNTRIES, I made vanish the drop down menues and present fields for people to write their own details.

Same happens when they select USA, Except is adds a Zip Code field that doenst show for OTHER COUNTRIES.

All of that looks and works wondeful except when from the fields display for OTHER COUNTRIES or USA people go back to El Salvador.

I made the fields vanish OK but when trying to display the States and Cities again it doenst find the DEFAULT STATE to display. (I thought line 311 would take care of it but it didnt).

Plaese download my work of art and change the extention from .txt to .html to see how it works and see the sourse for the complete script.

If you know what Im lacking please let me know..

Best regards
Attached Files
File Type: txt Country_Dropt_Down.txt (15.1 KB, 277 views)
Jul 4 '11 #1
0 1253

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by hemanth.singamsetty | last post: by
3 posts views Thread by scaredemz | last post: by
8 posts views Thread by barbarowa | last post: by
3 posts views Thread by rsteph | last post: by
4 posts views Thread by TycoonUK | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.