No. Fields with the same name name return a comma-delimited list when more
than 1 is checked. Also, a checkbox is not True or False, it is Undefined or
Value (of value="#checkbox_value#).

In your case, the hidden field should be present on forms with checkboxes
and provide, as you surmised, a defualt value of 0.
Use IsDefined('FORM.checkbox_name') in the UPDATE to determine whether to
updaytre the field.


-----Original Message-----
From: daniel kessler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 01, 2005 1:44 PM
To: CF-Talk
Subject: RE: inserting checkboxes into a db


><input type="hidden" name="c1" value="0">
>       <input type="checkbox" name="c1" value="a">
>       <input type="checkbox" name="c1" value="b">

So the hidden sets the default value, right?  Here's what I did.

on the page:
<input type="hidden" name="#checkbox_name#" value="0">
<input name="#checkbox_name#" #checked# type="checkbox" id="#checkbox_name#"
value="#checkbox_value#">

and on the UPDATE page, I left it as is:
<cfif structKeyExists(form,'mandate')>
     <cfset session.mandate = form.mandate>
mandate = <cfqueryparam value="#session.mandate#"
cfsqltype="CF_SQL_NUMERIC">,
</cfif>

So, whenever the checkbox exists, it'll either input this the checkbox value
or it's hidden field, because the checkbox won't overwrite it.  right?

oh, I just checked that and it sorta works.  If it's not checked, it works
fine.  If it's checked, then it puts out 38352 in the value, rather than the
1 it's supposed to be.  I suppose it's having problems with two fields being
named the same.

While I don't know if this is how you meant for me to implement it, it
seemed intriguing.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208248
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to