Log in

View Full Version : drop down menu auto fills a field



avidcat
08-11-2008, 09:18 PM
This is what we are trying to do.

When an item in a drop down field is selected, a text field within the same form will auto fill with the drop down menu value. But the text field will need to be locked so that they need to select from the drop down to change it.

Thanks for any help.

Nile
08-12-2008, 12:26 AM
This should do it for you avidcat:


<form>
Transportation method: <select name="transportSelect" onchange="this.form.elements['transport'].value=this.value">
<option value="Please select an option"></option>
<option value="Car">Car</option>
<option value="Boat">Boat</option>
<option value="Air">Air</option>
</select>
<input type="text" name="transport" value="Please select an option" disabled="yes" />
</form>

avidcat
08-12-2008, 12:59 AM
That might just work perfect, thanks for coding that. I really appreciate it! :)