4 Replies Latest reply on Mar 28, 2007 4:25 PM by The ScareCrow

    Checkbox

    tapping Level 1
      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>
        • 1. Re: Checkbox
          The ScareCrow Level 1
          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
          • 2. Re: Checkbox
            tapping Level 1
            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>
            • 3. Re: Checkbox
              Dan Bracuk Level 5
              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.
              • 4. Re: Checkbox
                The ScareCrow Level 1
                You have not set a value for the checkbox.
                Also ensure the form is using a method of "post"

                Ken