Let me get this straight:  you want to query a database and then build a
form with checkboxes that are checked if the database says that they should
be checked? If that's the case, here's roughly how I check boxes on a form
from a database:

<cfoutput query="qryPolicy">
        <input type="Checkbox" value="#District#" name="District" <cfif
qryPolicy.District>checked</cfif>>
        <input type="Checkbox" value="#School#" name="School" <cfif
qryPolicy.School>checked</cfif>>
        #Policyname#
</cfoutput>

If that's not what you want, please describe again what you are trying to
do. It may also help to step back just a bit and tell us also the overview
of what you are trying to accomplish (from a user standpoint).

Jeremy




> -----Original Message-----
> From: Susan N. Klos [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 10:58 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Getting the data from checkboxes into the database
> 
> 
> OK.  I understand that.  So I tried the following on the form 
> page and it
> gave me blanks also.  
> <CFQUERY NAME="qryPolicy" DATASOURCE="SDFS">
> SELECT tblPolicy.PolicyNumber, tblPolicy.PolicyName, 
> tlnkPolicy.District,
> tlnkPolicy.School
> FROM tblPolicy LEFT JOIN tlnkPolicy ON tblPolicy.PolicyNumber =
> tlnkPolicy.policyNumber
> </CFQUERY>
> 
> <form name="TargetGroups" action="ProcessPage7.cfm" method="post">
> <table border="1"><tr><th>District Policy</th><th>School
> Option</th></tr><tr>
> 
> 
> <!--- <input type="Hidden" name="DistrictId" 
> value="#session.DistrictID#">
> --->
> <cfoutput query="qryPolicy">
> 
> <td><input type="hidden" value="#Policynumber#" name="Policynumber">
> <input type="Checkbox" value="#District#" name="District"> </td>
> <td><input type="Checkbox" value="#School#" name="School"> </td>
> <td><font size="-1" style="TimesNewRoman"> 
> #Policyname#</font></td></tr>
> 
> </cfoutput></table>
> <input type="Submit" value="SUBMIT">
> 
> 
> 
> </form>
> 
> This is an input form only.  I do not need to reflect what is 
> already in the
> database.  How do I set checked boxes to true, leave the 
> unchecked boxes
> alone and 
> 
> -----Original Message-----
> From: Clint Tredway [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 11:18 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Getting the data from checkboxes into the database
> 
> 
> You have to have a value in your check box form element. If 
> there is no
> value, then there is nothing to insert.
> 
> HTH
> 
> ---------- Original Message ----------------------------------
> From: "Susan N. Klos" <[EMAIL PROTECTED]>
> Date: Thu, 2 Aug 2001 11:14:24 -0400 
> 
> Table to insert into:
> tlnkPolicy
>      PolicyID - PK
>      DistrictID - FK
>      PolicyNumber - FK
>      District - Yes/No
>      School - Yes/No
>      PolicyDesc
>  
> Form page:
>  
> <cfquery name="qryPolicy" datasource="sdfs">
> Select PolicyNumber, PolicyName
> >From tblPolicy
> </cfquery>
>  
> <form name="TargetGroups" action="ProcessPage7.cfm" method="post">
> <table border="1"><tr><th>District Policy</th><th>School
> Option</th></tr><tr>
>  
> 
>  
> <td><input type="hidden" value="#Policynumber#" name="Policynumber">
> <input type="Checkbox" value="" name="District"> </td>
> <td><input type="Checkbox" value="" name="School"> </td>
> <td><font size="-1" style="TimesNewRoman"> 
> #Policyname#</font></td></tr>
>  
> </cfoutput></table>
> <input type="Submit" value="SUBMIT">
> </form>
>  
>  
>  
> Action Page:
> <cfloop list="#PolicyNumber#" index="i">
> <cfquery datasource="#application.db#">
>  Insert into tlnkPolicy (DistrictID, District, School, PolicyNumber)
>  Values ('#session.DistrictID#', '#form.District#', 
> '#form.School#', #i#)
> </cfquery>
> </cfloop>
>  
> The problem is that no matter what I do or do not check in 
> the checkboxes on
> the form, all of the policynumber(s) show up in the database 
> and nothing in
> the District or School columns.  There should be blanks or yes in the
> District or School columns. And I do not want to see a record for a
> policynumber if there is no check in District, School or both
>  
>  
>  
>  
>  
>  
> 
> 
> 
> --------------------------------------------------------------
> -----------
> This email server is running an evaluation copy of the 
> MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: 
> www.mailshield.com
> 
> 
> 
> --------------------------------------------------------------
> -----------
> This email server is running an evaluation copy of the 
> MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: 
> www.mailshield.com
> 
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
> 
> --------------------------------------------------------------
> -----------
> This email server is running an evaluation copy of the 
> MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: 
> www.mailshield.com
> 
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
> 

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to