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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox behave like Radio Button

Status
Not open for further replies.

neomorpheus

Programmer
Mar 9, 2001
47
US
I am kinda lost here, and I tried looking up most of the forum here for a solution....but not successful. I would appreciate some help if anybody could spare a few minutes for this question.

I am trying to comeup with a solution for a pair of checkboxes to behave like radio button. Which means that if one of the pair is clicked, the other one if already checked is unchecked and viceversa.

I have for example four rows of recors with two checkboxes at end of each row. One is TO SUBSCRIBE and the other UNSUBSCRIBE. If subscribe is already selected and the user clicked Unsubscribe, it has to basically toggle.


Code:
-----
<cfloop query = &quot;qRules&quot;>

Display Newsletter:#DisplayName#

<input type=checkbox name=&quot;#qDLRule.Code#%-1&quot; <cfif qClientListRulesSelect.checked>checked</cfif> value=&quot;-1&quot;>

<input type=checkbox name=&quot;#qDLRule.Code#%0&quot; <cfif NOT qClientListRulesSelect.checked>checked</cfif> value=&quot;0&quot;>

</cfloop>

Thanks for all your help
 
Check 1 <input type=&quot;checkbox&quot; name=&quot;c1&quot; value=&quot;1&quot; onclick=&quot;this.form.c2.checked=!this.checked&quot;>
Check 2 <input type=&quot;checkbox&quot; name=&quot;c2&quot; value=&quot;1&quot; onclick=&quot;this.form.c1.checked=!this.checked&quot;>

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top