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

cfupdate and checkboxes

Status
Not open for further replies.

sevex

Programmer
Joined
Sep 18, 2001
Messages
74
Location
CA
I'm using cfupdate to update some records that use a checkbox (yes/no) field. The problem is that if the field is "on" and I uncheck the checkbox then use cfupdate, it doesn't set the field to "off". But the opposite works fine.

Is there any way to have cfupdate and checkboxes co-operate with each other?
 
Try setting the default value of the checkbox to false before calling <cfupdate>

<cfparam name=&quot;form.myCheckBox&quot; default=&quot;False&quot;>

code...

<cfupdate...> - tleish
 
I was afraid I'd end up doing something like that... there's just so... many... checkboxes...

sigh

Thanks though, I'll give that a shot.
 
What about setting them using a list, less code:

=== START CODE EXAMPLE ===
<cfloop list=&quot;checkbox1,checkbox2,checkbox3...&quot; index=&quot;i&quot;>
<cfparam name=&quot;form
Code:
[
i
Code:
]
&quot;
default=&quot;False&quot;>

</cfloop>
=== END CODE EXAMPLE === - tleish
 
I thought of that, but wasn't sure how so I just did it without. It works great, thanks again.

I'll try that list thing later however. Soon I get to make this thing searchable :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top