Skip to main content
Participant
July 30, 2009
Question

Getting started with flash forms - cfformgroup with checkboxes PLEASE HELP!!

  • July 30, 2009
  • 1 reply
  • 1471 views

Hello all,

I've been developing basic ColdFusion sites for quite a while but just recently took the plunge into RIA's. I have two problems:

1) How can I get a checkbox inside the <cfformgroup> tag to display a string value once the submit button is clicked (on the results page)?

2) How can I stop the unchecked checkboxes to stop returning a "false" value?

Here's my code:

<cfform action="#cgi.script_name#?#cgi.query_string#" format="flash" width="800" height="600" timeout="1800">
    <cfformgroup type="tabnavigator">

<cfformgroup type="page" label="Page 1"><br />
            <cfformitem type="HTML">SUPERVISION</cfformitem>
                        <cfinput type="checkbox" required="no" name="satisfactory" Label="Satisfactory" value="Satisfactory">
                        <cfinput type="checkbox" required="no"name="person" Label="Person in Charge present, certified, demonstrates knowledge and performs duties" value="Person in Charge">
                        <cftextarea required="no" name="commentsPerson" cols="47" rows="5"></cftextarea>
                        <cfinput type="checkbox" required="no" name="training" Label="Employee training, documentation of training" value="Employee Training">
                        <cftextarea required="no" name="commentsTraining" cols="47" rows="5"></cftextarea>
                        <cfinput type="checkbox" required="no" name="awareness" Label="Management Awareness, Policy Present" value="Management Awareness">
                        <cftextarea required="no" name="commentsAwareness" cols="47" rows="5"></cftextarea>
                        <cfinput type="checkbox" required="no" name="reporting" Label="Proper Use of Reporting, Restriction and Exclusion" value="Proper use of Reporting">
                        <cftextarea required="no" name="commentsReporting" cols="47" rows="5"></cftextarea>
         </cfformgroup>

     </cfformgroup>

</cfform>

I clicked the second checkbox and entered "test" in the textarea field and I get this when I click submit:

SUPERVISION
true
test
false
false
false

I would like it instead to show:

SUPERVISION

Person in Charge (instead of true)

test (or whatever comments are entered into the field)

I don't claim to be a CF guru but I have tried everything that would normally work in a regular cfform.  If checkboxes aren't feasible (I just prefer them because layout wise they're neater) any code samples of what will work would be most appreciated.

Thanks in advance.

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    August 9, 2009

    Checkboxes can have a string as value only in HTML forms. A checkbox in a flashform can only have the value true or false.

    One way out is to bind a hidden field to the checkbox, and to pass the "Person in Charge" string as the value of the hidden field. To do so, follow these steps:

    1) add the attribute name="myForm" to the cfform tag;

    2) include this field in the form <cfinput type="hidden" name="person_in_charge" bind="{myForm.person?'Person in charge':'No one in charge'}">