...

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



mtkirwan
07-14-2004, 01: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,

Matthew





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, 02:04 AM
<html>
<body>
<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">
</form>
</body>
</html>


Vinny

mtkirwan
07-14-2004, 03:24 AM
Thanks Vinny

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

Vinny



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum