How to pass "checked" property of a checkbox

I have two "simple" CF pages. The first is an input form page where a user is given, among other things, the option of checking any of 4 check boxes. The second page is a processor page that verifies the data that was entered on the input page. I am trying to have the checked property of each of the 4 checkboxes copied to the processor page so that the user can once again review, or change their selections, if necessary. I can successfully pass the results of the text fields from the input page to the processor page and have those results appear correctly but I am not having luck with the checkboxes. The processor page has cfparam tags set as:
<cfparam name="form.checkbox1" default="">
<cfparam name="form.checkbox2" default="">
<cfparam name="form.checkbox3" default="">
<cfparam name="form.checkbox4" default="">

and the code in tha page where I am "re-displaying" those 4 checkboxes is:

<cfinput type="checkbox" name="checkbox1" value="rp" />Roads<br />
<cfinput type="checkbox" name="checkbox2" value="cl" />Contacting<br />
<cfinput type="checkbox" name="checkbox3" value="se" />Safety<br />
<cfinput type="checkbox" name="checkbox4" value="tp" />Trail<br />

I had assumed that, for example the first checkbox, I could use something like:
<cfinput type="checkbox" name="checkbox1" value="rp" <cfif #form.checkbox1.value# eq "rp">checked="yes"</cfif> Roads />
But that is not working. I have tried various other variations of that theme and still cannot make it work. Might someone offer me some guidance?
Thanks,
Lee
lepirtleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew MaurerCommented:
This may help show you want is happening...

<cfparam name="form.checkbox1" default="">
<cfparam name="form.checkbox2" default="">
<cfparam name="form.checkbox3" default="">
<cfparam name="form.checkbox4" default="">
 
<cfdump var="#form#">
 
<cfif form.checkbox1 NEQ "">I see number Roads<br /></cfif>
<cfif form.checkbox2 NEQ "">I see number Contacting<br /></cfif>
<cfif form.checkbox3 NEQ "">I see number Safety<br /></cfif>
<cfif form.checkbox4 NEQ "">I see number Trail<br /></cfif>
 
<cfform action="#cgi.SCRIPT_NAME#">
    <cfinput type="checkbox" name="checkbox1" value="rp" />Roads<br />
    <cfinput type="checkbox" name="checkbox2" value="cl" />Contacting<br />
    <cfinput type="checkbox" name="checkbox3" value="se" />Safety<br />
    <cfinput type="checkbox" name="checkbox4" value="tp" />Trail<br />
    <input type="submit" />
</cfform>

Open in new window

0
Andrew MaurerCommented:
and if you dont understand what this is doing. copy the code and paste it on a blank cfm page. then call it with your browser
0
lepirtleAuthor Commented:
Hi Zadoc,
I tried your solution but it is basically dumping the output on my processing page.

If you go to http://www.leepirtle.com/lib/join/test01ckmemb.cfm and enter some bogus info for the name and address (leave the city blank) and check 1 or more of the 4 check boxes "Road Projects", "Contacting Legislators" etc then press the "pay by check button you will see the result on the "processing page".
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Andrew MaurerCommented:
Right... so what do you want to do? I gave you an example on how to check for those values
0
lepirtleAuthor Commented:
Zadoc,
I didn't see your recommendation about pasting the code into a blank cfm page till I posted the previous entry from you. So I just took your suggestion and can see that the output is(are) text strings depending on which checkboxes are checked but, and perhaps there is something obvious that I am not seeing, but I want the checkboxes themselves to be checked instead of the text strings being displayed.
Thanks,
Lee
0
Andrew MaurerCommented:
sorry, my mistake
<cfparam name="form.checkbox1" default="">
<cfparam name="form.checkbox2" default="">
<cfparam name="form.checkbox3" default="">
<cfparam name="form.checkbox4" default="">
 
<cfdump var="#form#">
 
<cfform action="#cgi.SCRIPT_NAME#">
    <input type="checkbox" name="checkbox1" value="rp" <cfif form.checkbox1 NEQ "">checked</cfif> />Roads<br />
    <input type="checkbox" name="checkbox2" value="cl" <cfif form.checkbox2 NEQ "">checked</cfif> />Contacting<br />
    <input type="checkbox" name="checkbox3" value="se" <cfif form.checkbox3 NEQ "">checked</cfif> />Safety<br />
    <input type="checkbox" name="checkbox4" value="tp" <cfif form.checkbox4 NEQ "">checked</cfif> />Trail<br />
    <input type="submit" />
</cfform>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
black0psCommented:
While Form.Checkbox1 NEQ "" works, you can also use:
<cfif IsDefined("Form.Checkbox1")>checked</cfif> but you wouldn't create the Form.Checkbox1 with cfparam.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.