Forum Moderators: open

Message Too Old, No Replies

javascript countrey selector in form

         

helohelo

12:54 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



Hi and happy new year!
i want to use a javascript countrye selector in a php form.
Is this possible?

the javascript region/country/state script: (without the javascript, this is probaly to long to show here.
------------
<form name="globe">
<select name="region" onChange="populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)">
<option selected value=''>Select Region</option>
<option value='asia'>Asia</option>
<option value='africa'>Africa</option>
<option value='australia'>Australia</option>
<option value='europe'>Europe</option>
<option value='middleeast'>Middle East</option>
<option value='lamerica'>Latin America</option>
<option value='namerica'>North America</option>
<option value='samerica'>South America</option>
</select>
<select name="country" onChange="populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)">
<option value=''><--------------------</option>
</select>
</form>

------------

I know I cannot use a form into my excisitng form. Is there a way around.

My excisitng form:
---------------------
<form action="searchengines.php?action=addgo" method="POST" enctype="multipart/form-data">

lists
</form>

--------------------

adni18

1:09 pm on Jan 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about just losing the form tag in your script, and using:

<select name="region" onChange="populateCountry(document,document.getElementsById('country').options[document.getElementsById('country').selectedIndex].value)">
<option selected value=''>Select Region</option>
<option value='asia'>Asia</option>
<option value='africa'>Africa</option>
<option value='australia'>Australia</option>
<option value='europe'>Europe</option>
<option value='middleeast'>Middle East</option>
<option value='lamerica'>Latin America</option>
<option value='namerica'>North America</option>
<option value='samerica'>South America</option>
</select>
<select name="country" onChange="populateUSstate(document,document.getElementsById('country').options[document.getElementById('country').selectedIndex].text)">
<option value=''><--------------------</option>
</select>

helohelo

1:22 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



Thanks, i found this too.
And my main form had no form name or id
so i changed
<form action="pathtofile.php?action=addgo" method="POST" enctype="multipart/form-data">

<form action="pathtofile.php?action=addgo" method="POST" enctype="multipart/form-data" name="globe" id="globe">

because the javascript use the 'globe'name..

thanks