0

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>

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Nige Ridd
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.