Updating the value in a radio button from a text field
I have a form where an administrator can assign a volunteer to a specific activity. To do this I used radio buttons and that worked fine, but now my users want an extra button labelled "Other" and then they can type in an activity in a text field. I have this almost working but I am unable to copy the value in the text field to the radio button value, when I submit the form the button value continues to be "other", i.e. the text field value is not overwriting the button value. Here's the code for the button and text fields (simplified a bit to remove the spry code that sets the button as "Checked")
<input type="radio" name="assignedactivity" value="other" />
Other...Please specify<br />
<input type="text" name="otherActivity" onsubmit="copyIt()" />
and here's the code for copyIt()
<script type = "text/javascript">
function copyIt() {
x = document.getElementById("otherActivity").value;
document.getElementById("assignedactivity").value = x;
}
</script>
I'd really appreciate it if someone could tell me what I did wrong.
Thanks,
Tony
