1

hello, i was wondering if anyone could help me find a way to allow a user to click items in a combo box and have its value populate an input field.

Thanks

4
Contributors
5
Replies
10
Views
6 Years
Discussion Span
Last Post by Samanalevi
0

give the input field an id. Set the combo box to call a function on change and pass the value to the function. Set that function to update the text field by id with the value received.

Can you figure it out from that or do you need all the code? I can't get that to you right now, maybe someone else can.

0

give the input field an id. Set the combo box to call a function on change and pass the value to the function. Set that function to update the text field by id with the value received.

Can you figure it out from that or do you need all the code? I can't get that to you right now, maybe someone else can.

Im sure i can make it work, thanks for the advice, ill post back when i figure it out.

0

I wasnt able to figure it out, i am not very good with javascript, if you have some free time can you post some code as an example. This is what i tried anyway.

<option  name="stop" id="stop" 

<input id="eStop" name="eStop"

onchange="populateField(this.form)"

function populateField(frm){
 test = frm.stop.value
 alert('work' test)
 frm.eStop.value = test
}

Thanks

0
<form>
<select name="sel1" onChange="populateField(this.form)" >
    <option value="">---Select---</option>
    <option value="stop" >Stop</option>
    <option value="start">Start</option>
</select>

<input type="text" id="eStop" name="eStop" />
</form>
<script type="text/javascript">
function populateField(frm){
 var test = frm.sel1.value;
 alert('work '+ test);
 frm.eStop.value = test;
}
</script>

It will work fine. Good luck.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.