Discussion:
CFInput, Checked and CFIF
(too old to reply)
hanzelmans
2005-05-23 13:10:13 UTC
Permalink
Can you not include a <cfif> in a CFInput field that is a checkbox?

I have attached the code that is throwing an error. I usually don't use
checkboxes with cfinput, but need to to use a Flash form that I'm being asked
to design.



<cfinput type="checkbox" name="SeniorDiv" value="1" label="Senior Division"
<cfif eventRecord.EVT_Division contains '1'>checked</cfif>>
stpaz
2005-05-23 13:22:27 UTC
Permalink
doubt it but you could do this:

<cfif eventRecord.EVT_Division contains '1'>
<cfset boolSeniorDiv = "yes">
<cfelse>
<cfset boolSeniorDiv = "No">
</cfif>

<cfinput type="checkbox" name="SeniorDiv" value="1" label="Senior Division"
checked="#boolSeniorDiv#">
dm2000t
2005-05-23 15:58:13 UTC
Permalink
I'm having a problem similar to yours. I am pulling records from a database
and building update forms. I could not get an <cfif> to work inside <cfinput>
tags.

I finally did this:

<cfif #webContact# EQ "1">
<cfinput name="webContact" type="checkbox" checked="yes" value="1">
<cfelse>
<cfinput name="webContact" type="checkbox" value="">
</cfif>
Web Contact

It works...but I have about 50 feilds I have to update.....Anyone know an
easier way?

Loading...