PDA

View Full Version : echoing drop down list value to a text box



sukanya.paul
09-18-2008, 08:53 AM
hi,
i have a drop down list called c_email which has a list of email ids.i also have a text box called c_mail. what i want to do is when i choose an email id from the drop down list the empty text box should get populated with the same value.
can someone help me with this?
thanks in advance..Suk

jscheuer1
09-18-2008, 09:15 AM
<form action="#">
<div>
<select name="c_email" onchange="this.form.elements['c_mail'].value = this.options[this.selectedIndex].value;">
<option value="Select" selected>Select</option>
<option value="someone_0@some.com">someone_0@some.com</option>
<option value="someone_1@some.com">someone_1@some.com</option>
<option value="someone_2@some.com">someone_2@some.com</option>
<option value="someone_3@some.com">someone_3@some.com</option>
<option value="someone_4@some.com">someone_4@some.com</option>
<option value="someone_5@some.com">someone_5@some.com</option>
</select>
<input type="text" value="Select" name="c_mail">
</div>
</form>

sukanya.paul
09-18-2008, 09:20 AM
Thanks :)