DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   ColdFusion (http://www.daniweb.com/forums/forum19.html)
-   -   Updating checkboxes (http://www.daniweb.com/forums/thread107074.html)

alakacha Jan 31st, 2008 12:05 pm
Updating checkboxes
 
How do you update checkboxes on a form in cold fusion?

I am using the following code to update other form elements :

<cfquery name="qry_content" datasource="A4265_gbci">
update tbl_emailsignup
set firstname = '#form.firstname#' ,
lastname = '#form.lastname#' ,
email = '#form.email#' ,
job = '#form.job#',
company = '#form.company#' ,
address1 = '#form.address1#' ,
address2 = '#form.address2#' ,
city = '#form.city#' ,
state = '#form.state#' ,
zip = '#form.zip#' ,
phone = '#form.phone#'
where id = #form.id#
</cfquery>

Nige Ridd Feb 2nd, 2008 3:47 pm
Re: Updating checkboxes
 
The value of a check box can be set using something like
<cfinput type="checkbox"
name="SelectedDepts"
value="4">
BUT this value will only be returned if the user checks the box, so either do an isDefined or use cfparam to default it to something.

One thing you should consider as well is changing your query to use cfqueryparam instead of puttine the actual value in quotes into the statement. This aids performance and also helps stop quotes in the data causing problems.
Nige


All times are GMT -4. The time now is 10:20 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC