This would be dead simple using jQuery.
I just wrote and tested this. I think it does what you want.
<html>
<head>
<title></title>
<script src="/include/js/jquery.js"></script>
<script>
function myFunction(thisValue){
if(thisValue == "OUT OF STOCK"){
$("#myID").val("0");
}
}
</script>
</head>
<body>
<select name="Comments#getLineItems.CurrentRow#"
OnChange="myFunction(this.value)">
<option value="SHIPPED"SHIPPED</option>
<option value="SHIPPED AVAILABLE">SHIPPED AVAILABLE</option>
<option value="DISCONTINUED">DISCONTINUED</option>
<option value="OUT OF STOCK">OUT OF STOCK</option>
</select>
<input id="myID" type="text"
name="QTYShipped#getLineItems.CurrentRow#" value="1" size="4" maxlength="3">
</body>
</html>
You would, of course, have to download the jquery library and change the
path to it appropriately.
You can find it here <http://www.jquery.com>.
Hope this helps.
Cheers,
Chris
Che Vilnonis wrote:
> I have a form with a varied number of form fields (they are dynamically
> created). Two of the form fields are a input box and a select box. I loop
> through my query and define the form names like so:
>
> <input type="text" name="QTYShipped#getLineItems.CurrentRow#" value="1"
> size="4" maxlength="3">
>
> and
>
> <select name="Comments#getLineItems.CurrentRow#">
> <option value="SHIPPED">SHIPPED</option>
> <option value="SHIPPED AVAILABLE">SHIPPED AVAILABLE</option>
> <option value="DISCONTINUED">DISCONTINUED</option>
> <option value="OUT OF STOCK">OUT OF STOCK</option>
> </select>
>
> How can I, using Javascript, use an onChange event so that when "OUT OD
> STOCK" is selected from the pulldown, the text value is auto changed from 1
> to 0. I am getting hung up with the dynamic form names and declaring them in
> my javascript function.
>
> Hope this makes sense? Che
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265259
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4