Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio buttons value printed into textbox 1

Status
Not open for further replies.

chrismassey

Programmer
Aug 24, 2007
264
GB
Hello,

I am trying to create a group of radio buttons, and if one is selected then I want to print its value into a textbox live (interactively). I have tried to find a solution by searching the web but I haven't found anything that explains how. I believe this is a job for javascript but I am stumped.

Thanks,
Chris
 
Yes this is a JS question and as such should go in the forum216.

Anyway, the basic script would look like:


Code:
<form name=myform>
<input type=text name="mytextbox">
<input type=radio name="myradiobutton" value="Somevalue" 
OnChange="document.myform.mytextbox.value=this.value;">

<input type=radio name="myradiobutton" value="Othervalue" 
OnChange="document.myform.mytextbox.value=this.value;">
...
</form>



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
vacunita,

The script you have shown there works great. Thats all I needed. Thank you very much

Chris
 
Glad I could help.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top