Hi Seth,
Thanks for the reply, however your technique is similar to what I had tried
along with the one I posted- and it has it's own difficulty. Basically my
technique doesn't remember the correct checkboxes UNLESS all or none are
selected(it only checkmarks the first checkbox), Whereas, the one you
mentioned, puts checkmarks to ALL the boxes even if I select just one. It
does, however, remember correctly if all or none are selected.
I think that my whole logic maybe flawed to start with. Is there a true and
tried technique to populate checkboxes from a database? Do I have to use
arrays maybe?
I would appreciate all the help.
Hassan
Here are the Queries that I am using:
===========================
<cfif isdefined('url.id')>
<cfset cat_id = "#url.id#">
<!--- get All contents for the category_id in the database--->
<cfquery name="getCats" datasource="timberdev" dbtype="ODBC">
select contents.category_id,  category_name,  contents.content_id,
contents.content_name, content_url
from categories,  contents
 where (contents.category_id = #cat_id#) and
   (categories.category_id = #cat_id#)
Order By contents.category_id,  category_name, contents.content_id,
contents.content_name
</cfquery>
=============================
<!--- get user selected content from database to mark the checkboxes --->
<cfquery name="UserContents" datasource="timberdev" dbtype="ODBC">
 select user_content.content_id
from user_content, contents
where user_content.content_id = contents.content_id and
user_content.timber_id = 12 and
contents.category_id = #cat_id#
Order By contents.content_id, contents.content_name
</cfquery>
======================
Outputting - sorting by category

<cfoutput query="getCats" group="category_id">
     #category_name#
      <input type="hidden" name="category_id" value="#category_id#">
       <input type="submit" name="savePref" value="     Save     "><br>

<b>Available Items</b> [Click on the link to see a preview of that item]<br>

 <CFOUTPUT>
    <INPUT TYPE="checkbox" NAME="content_ID" VALUE="#GetCats.content_ID#"
CHECKED="#YesNoFormat          (GetCats.content_ID IS
UserContents.content_id)#"> <a href="#content_url#"
target="_new">#content_name#</a>
</CFOUTPUT>

----- Original Message -----
From: Seth Petry-Johnson <>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 05, 2000 8:56 AM
Subject: Re: Remembering checked Checkboxes


> >4. Results of Query1are output. If an entry in query1 matches query2, it
is
> >CHECKED.
> >Here is the code I am using:
> ><cfoutput>
> >     <input type="checkbox" name="content_id" value="#content_id#"
> >     <cfloop query="AllContents">
> >     <cfif UserContents.content_id IS
AllContents.content_id>CHECKED</cfif>
> >     </cfloop>>
> ></cfoutput>
>
>
> I'm sure I totally understand what you are trying to do, but the above
code
> will only create *one* checkbox that may have a bunch of "CHECKED" strings
> in it.  To see what I mean just view the source code (HTML) for your form.
>
> I think you may want something like
>
> <CFOUTPUT QUERY="AllContents">
>     <INPUT TYPE="checkbox"
>         NAME="content_ID"
>         VALUE="#AllContents.content_ID#"
>         CHECKED="#YesNoFormat(AllContents.content_ID IS
> UserContents.content_id)#">
> </CFOUTPUT>
>
> Regards,
> Seth Petry-Johnson
> Argo Enterprise and Associates
>
> --------------------------------------------------------------------------
----
> 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.
>

------------------------------------------------------------------------------
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.

Reply via email to