• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Checkbox

New Here ,
Mar 27, 2007 Mar 27, 2007

Copy link to clipboard

Copied

I need to read my checkbox values from my action page. How would I accomplish this? Below is the code on the form page.

<cfquery name="getdocstate" datasource="ezloanchfs" >
SELECT DocName, state, docsetid, defaultdoc from tblDocSet
where state = '#statename#'
</cfquery>


<cfloop query="getdocstate">
<cfset docid = "#getdocstate.docsetid#">
<cfoutput>
<input name="printforms" type="checkbox" class="state" value="#docid#" <cfif #defaultdoc# eq 1> checked="checked" </cfif> >
#DocName# - #state#<br>
</cfoutput>
</cfloop>
TOPICS
Advanced techniques

Views

396

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 27, 2007 Mar 27, 2007

Copy link to clipboard

Copied

In the action page you need to confirm that the checkbox exists. It will only exist if it has been checked.

<cfif isDefined("form.printforms")>
The checkbox is checked, process here...
<cfelse>
The checkbox is not checked.
</cfif>

Ken

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2007 Mar 28, 2007

Copy link to clipboard

Copied

The action page states that the checkbox is not checked regardless of the fact that it is checked. Here is the code:

Form below:

<cfquery name="getdocstate" datasource="ezloanchfs" >
SELECT DocName, state, docsetid, defaultdoc from tblDocSet
where state = '#statename#'
</cfquery>


<cfloop query="getdocstate">
<cfset docid ='doc' & '#getdocstate.docsetid#'>
<cfoutput>
<input type="checkbox" name="#docid#" >
#DocName# - #state#<br>
</cfoutput>
</cfloop>


Action page:

<cfif isdefined("form.doc108")>
checked
<cfelse>
not checked
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 28, 2007 Mar 28, 2007

Copy link to clipboard

Copied

It would be a lot easier if you gave all your checkboxes the same name and different values. Then on your action page, you only have to check one variable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 28, 2007 Mar 28, 2007

Copy link to clipboard

Copied

LATEST
You have not set a value for the checkbox.
Also ensure the form is using a method of "post"

Ken

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation