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

Checkbox Input, Checked or Not Checked 1

Status
Not open for further replies.

jasonkeller

Programmer
May 23, 2001
16
US
How can I make the following checkbox form (1) work like the radio button input form (2), but with out the off option. I would like to just check on or check off and then update the access database

(1)<input type=&quot;checkbox&quot; name=&quot;white&quot; value=&quot;yes&quot;
<cfif #white# IS &quot;yes&quot;> checked</cfif>>Yes



(2)<input type=&quot;radio&quot; name=&quot;white&quot; value=&quot;yes&quot;
<cfif #white# IS &quot;yes&quot;> checked</cfif>>Yes
<input type=&quot;radio&quot; name=&quot;white&quot; value=&quot;no&quot;
<cfif #white# IS &quot;no&quot;> checked</cfif>>No
 
hey JasonKeller,

I'm not absolutely positive that I understand the question but I believe what you're looking for is 2 checkboxes that are mutually exclusive. I would do it like this:

Code:
<script language=&quot;javascript&quot;>
function switch1()
{
  document.formname.white1.checked=true
  document.formname.white2.checked=false;
  return false;
      
}
function switch2()
{
  document.formname.white2.checked=true 
  document.formname.white1.checked=false;
  return false;
}
</script>

<CFSET white = &quot;yes&quot;>
<form name=&quot;formname&quot; action=&quot;look.cfm&quot; method=&quot;post&quot;>
<input type=&quot;checkbox&quot; name=&quot;white1&quot; value=&quot;yes&quot; <cfif #white# IS &quot;yes&quot;> checked </CFIF> Onclick=&quot;switch1()&quot; >Yes 
<input type=&quot;checkbox&quot; name=&quot;white2&quot; value=&quot;no&quot;<cfif #white# is &quot;no&quot;> checked</cfif> Onclick=&quot;switch2()&quot; >No
</form>
[code]
If you're looking for something entirely different then try explaining it again.  I'll get it sooner or later.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top