View Full Version : Filling a text box based on whether a radio button gets selected or not

07-14-2004, 02:46 AM
Hi all,

I am a beginning at JavaScript and am at a loss on how to achieve the following.

I have one question labelled Q1. This question has the options Yes and No by way of a radio button. If the user selects Yes I want to fill a single text box with the text "1" to indicate Q1 has been answered.

Any ideas?

Kind Regards,


in a form. Each question consists of two radio buttons, Yes or Noa single radio button with option Yes or No.

Vincent Puglia
07-14-2004, 03:04 AM
<form name="theForm">
<input type="radio" value="1" name="theRad" onclick='this.form.theText.value = this.value'>
<input type="radio" value="" name="theRad" onclick='this.form.theText.value = this.value'>
<input type="text" name="theText">


07-14-2004, 04:24 AM
Thanks Vinny

Vincent Puglia
07-14-2004, 02:30 PM
You welcome, mtkirwan :)