thx Cameron

that was it.

-- gil

  -----Original Message-----
  From: Cameron Childress [mailto:[EMAIL PROTECTED]
  Sent: Sunday, February 08, 2004 5:37 PM
  To: CF-Talk
  Subject: RE: checkbox display problem

  Mayo, you look like you're on the right track.  I'd only insert records
into
  ARTICLEDISPLAY for articles that are going to be displayed for that
  category.

  You should be able to accomplish what you want by looping over a query of
  all available categories and then testing to see if the current article is
a
  member of that category.

  IE:

  <cfquery name="showCategories">
    SELECT *
    FROM categories
  </cfquery>

  <cfquery name="showChecked">
    SELECT *
    FROM ARTICLEDISPLAY
    WHERE article=#SOME_GET_VARIABLE#
  </cfquery>

  <cfoutput query="showCategories">
    #categoryName#<br/>
    <input type="checkbox" name="categories"
    <cfif
  listContains(valueList(showChecked.CategoryID),CategoryID)>checked</cfif>>
  </cfoutput>

  Essentially. valueList() will convert a column from a query into a comma
  delimited list which you can then test for matches.

  -Cameron

  -----------------
  Cameron Childress
  Sumo Consulting Inc
  ---
  land:  858.509.3098
  cell:  678.637.5072
  aim:   cameroncf
  email: [EMAIL PROTECTED]

  -----Original Message-----
  From: mayo [mailto:[EMAIL PROTECTED]
  Sent: Sunday, February 08, 2004 2:21 PM
  To: CF-Talk
  Subject: checkbox display problem

  I have a site which which will sort articles into numerous categories.

  The user selects the categories via checkboxes (currently 9, it will
grow).

  Articles may be in more than one category.

  There are over 5000 articles and growing at several 100 a month.

  The easiest solution would be an articleDisplay table

  ARTICLEDISPLAY
  articleDisplayID
  articleID
  articleCategoryID
  isDisplayed

  will one record for each category

  EXAMPLE:

  articleDisplayID---articleID---articleCategoryID---isDisplayed
  1---------------------1001-----------1-----------------0
  2---------------------1001-----------2-----------------1
  3---------------------1001-----------3-----------------1
  4---------------------1001-----------4-----------------0
  5---------------------1001-----------5-----------------0
  6---------------------1001-----------6-----------------1
  7---------------------1001-----------7-----------------0
  8---------------------1001-----------8-----------------0
  9---------------------1001-----------9-----------------1
  10---------------------1002-----------1-----------------0
  11---------------------1002-----------2-----------------0
  12---------------------1002-----------3-----------------1
  ...
  etc....

  Now this will lead to a fairly big table. Currently it would be 5000
  articles by 9 categories. It will soon be 10,000 articles by 15
categories.

  So, the solution seems to be to only put articles to be displayed into the
  table.

  Here's the problem: How does one display all the categories and CHECK the
  categories where the article will be displayed.

  The following displays all the categories and a corresponding checkbox.

  <cfoutput query="showCategories">

  #categoryName#<br/>
  <input type="checkbox" name="categories">

  </cfoutput>

  I'm blocking on how to show the selected categories in the above output.

  How does one get AND DISPLAY all categories

  <cfquery name="showCategories">

  SELECT *
  FROM categories

  </cfquery>

  but select the checkboxes with

  <cfquery name="showChecked">

  SELECT *
  FROM display
  WHERE article=#SOME_GET_VARIABLE#

  </cfquery>

  I hope this wasn't too long and confusing :-)

  Gil
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to