Hi people,
I am trying to populate a textfield value based on which of three radio buttons are checked. this is the code I have tried but nothing happens when I select the buttons
and this is what i have to update the values
I know I have something wrong but I am not sure what it is, any help would be appreciated
Regards
Paul
I am trying to populate a textfield value based on which of three radio buttons are checked. this is the code I have tried but nothing happens when I select the buttons
Code:
<script language="JavaScript">
function showValues(){
if (document.frmReason.optAction.checked.value ==1){
document.frmReason.txtAction.value ="C/Comp"
}
else{
if (document.frmReason.optAction.checked.value ==2){
document.frmReason.txtAction.value ="Today"
}
else{
if (document.frmReason.optAction.checked.value ==3){
document.frmReason.txtAction.value ="Tomorrow"
}
else{
document.frmReason.txtAction.value =""
}
}
}
}
</script>
and this is what i have to update the values
Code:
<input name="optAction" type="radio" onClick="showValues()" value="1" />
C/Comp</label></td>
<td width="69"><input name="optAction" type="radio" onClick="showValues()" value="2"/>
Today</td>
<td width="94"><input name="optAction" type="radio" onClick="showValues()" value="3"/>
Tomorrow</td>
<td width="222"><input name="txtAction" type="text" id="txtAction" size="12" maxlength="12" />
I know I have something wrong but I am not sure what it is, any help would be appreciated
Regards
Paul