Hello Christine,
You may tried something like this
<CFSET ISCHECKED = IIF(Len(Groups) NEQ 0,DE(" CHECKED"),DE(""))>
<INPUT TYPE="checkbox" NAME="Groups"#ISCHECKED#>
I don't know what type of data the "groups" column is. When I use a
check box I setup the data type as a number, 0 not checked - 1
checked. And I also name the checkbox a difference name then the
others boxes.
<CFSET ISCHECKED = IIF(SendNoEmail EQ 1,DE(" CHECKED"),DE(""))>
<INPUT TYPE="checkbox" NAME="SendNoEmail:#Email_ID#"#ISCHECKED#>
Hope this helps
Thursday, Thursday, June 22, 2000, you wrote to me:
CK> Hi all!
CK> Problem: A user selects from a group of check boxes and
CK> submits. When going to edit the info, can't figure out the
CK> best way to pull the info back out of the database into the
CK> checkboxes (so users can see and edit which boxes they have
CK> checked).
CK> Background:
CK> I am creating a contact management application. In the
CK> create a new contact area, the user has a has a list of
CK> check boxes (they wanted check boxes for some reason) for
CK> adding the new contact to one or several groups. Ex: the
CK> new contact can be in the sales and admin groups or whatever
CK> (like 20 groups to choose from). Anyway, there are two
CK> basic tables in my database, 1 for contact information and 1
CK> with group names and descriptions. On the enter a new
CK> contact form, the group names and descriptions are being
CK> pulled out of the group table for the checkboxes:
CK> <cfoutput query="Groups">
CK> <tr>
CK> <th align="right"></th>
CK> <td>
CK> <b>#GroupName#</b><input type="checkbox" name="Groups"
value="#GroupName#">>
CK> #Description#
CK> </td>
CK> </tr>
CK> </cfoutput>
CK> This works ok. It enters the names of any groups checked
CK> into the contacts table in one field called "Groups" with
CK> comma separators . I'm using this code to pull the info
CK> back out for the editing contact form:
CK> <cfquery datasource="datasource" name="Contact">
CK> SELECT g.GroupID, g.GroupName, g.Description, c.ContactID,
CK> c.FirstName, c.LastName, c.MiddleInit, c.Address, c.City,
CK> c.StateOrProvince, c.ZipCode, c.Country, c.CompanyName,
CK> c.Title,
CK> c.WorkPhone, c.WorkExtension, c.HomePhone, c.CellPhone,
CK> c.Fax,
CK> c.Email, c.ReferredBy, c.Notes, c.Groups
CK> FROM Groups g, Contacts c
CK> WHERE c.ContactID=#ContactID#
CK> </cfquery>
CK> ...
CK> <CFIF #Groups# CONTAINS #GroupName#>
CK> <tr>
CK> <th align="right"></th>
CK> <td>
CK> <b>#GroupName#</b><input type="checkbox" name="Groups"
CK> value="#GroupName#" CHECKED> #Description#
CK> </td>
CK> </tr>
CK> </CFIF>
CK> <CFIF #Groups# DOES NOT CONTAIN #GroupName#>
CK> <tr>
CK> <th align="right"></th>
CK> <td>
CK> <b>#GroupName#</b><input type="checkbox" name="Groups"
CK> value="#GroupName#"> #Description#
CK> </td>
CK> </tr>
CK> </CFIF>
CK> This actually works ok too except for the fact that a table
CK> full of all the same info, except for the group checkbox,
CK> appears for every group. Ex: 3 groups - 1st table has all
CK> info and then Group1 checkbox (either checked or not), 2nd
CK> table...Group2 checkbox, third table...Group3 checkbox.
CK> I'm thinking that it has to do with how the groups are being
CK> stored in the database? Is there a better way?
CK> Thanks for any help!
CK> Christin
CK> ------------------------------------------------------------------------------
CK> Archives: http://www.eGroups.com/list/cf-talk
CK> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Thanks,
Mike Hughes
Freelance Cold Fusion Applications Developer
mailto:[EMAIL PROTECTED]
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.