<td>
<script type="text/javascript">
function autoPopulate_myFavouriteFruit(targetElement) {
if (targetElement.options[targetElement.selectedIndex].value == '-1') {
return;
}
if (targetElement.options[targetElement.selectedIndex].value == '') {
return;
}
targetElement.form.elements['myFavouriteFruit'].value=targetElement.options[targetElement.selectedIndex].value;
}
</script>
<input type="text" name="myFavouriteFruit" value="banana" id="myFavouriteFruit"/>
<select onChange="autoPopulate_myFavouriteFruit(this);">
<option value="-1">--- Please Select ---
<option value="">
<option value="apple">apple
<option value="banana" selected="selected">banana
<option value="pineaple">pineaple
<option value="grapes">grapes
</select>
</td>
</tr>
Other Struts examples (source code examples)
Here is a short list of links related to this Struts ComboBox-2.txt source code file:
Struts example source code file (ComboBox-2.txt)
This example Struts source code file (ComboBox-2.txt) is included in the DevDaily.com
"Java Source Code
Warehouse " project. The intent of this project is to help you "Learn Java by Example " TM .
The Struts ComboBox-2.txt source code
<tr>
<td class="tdLabel">My Favourite Fruit: