General discussion


Radio Buttons & Text Buttons

By vhansen86 ·
I have a form with several textboxes with radio buttons. I have everything working the way I need to except for when the textbox is clicked I want the radio button to show it is checked. I have it working vice versa and once one item is checked the one previously checked is unchecked.


<script language="JavaScript">

function click(which) {
document.formname.Chk_field[which].checked = true;



<form name="formname">

<input type="RADIO" name="Chk_field" value="1"
OnClick="document.formname.textbox1.focus();return true;">
<A HREF="javascript:click(0)" class="hrefstyle"></A><input type="textbox" name="textbox1"></p>

<input type="RADIO" name="Chk_field" value="1"
OnClick="document.formname.textbox2.focus();return true;">
<A HREF="javascript:click(1)" class="hrefstyle"></A>
<input type="textbox" name="textbox2"></p>

<input type="RADIO" name="Chk_field" value="1"
OnClick="document.formname.textbox3.focus();return true;">
<A HREF="javascript:click(2)" class="hrefstyle"></A>
<input type="textbox" name="textbox3"></p>



<!---End of Source code--->

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Radio Buttons & Text Buttons

by allenhunter In reply to Radio Buttons & Text Butt ...

If you change the names of the radio buttons so that they are unique, you can then easily change their checked status with the onfocus and onblur events of the text boxes. Add the following code to the textbox tags...


Make sure to change the names where appropriate.

Collapse -

Radio Buttons & Text Buttons

by vhansen86 In reply to Radio Buttons & Text Butt ...

Thanks for the effort though. Could not get it to work.

Collapse -

Radio Buttons & Text Buttons

by vhansen86 In reply to Radio Buttons & Text Butt ...

This question was closed by the author

Related Discussions

Related Forums