Thanks Barney,


You Da Man... I figured I would have to use valueList() but I just was not
formatting my statement right. It's all good now... Again Thanks...


- Neal

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2003 2:43 PM
To: CF-Talk
Subject: RE: dynamic checkboxes...


This is totally divorced from your code to keep it easy to read.  Applying
the algorithm to your specific formatting will be trivial.

<cfset idlist = valueList(testimonials.testimonialID) />
<cfloop query="testimonials">
  <input type="checkbox" name="testimonials" value="#testimonialID#"
    <cfif listFind(idlist, testimonialID)> checked="checked"</cfif> />
#name#<br />
</cfloop>

cheers,
barneyb
  -----Original Message-----
  From: Bailey, Neal [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 22, 2003 1:23 PM
  To: CF-Talk
  Subject: dynamic checkboxes...

  Hey guys,

  Stuck again... I have a list of Testimonials that I am displaying from a
DB
  and next to each one I have a checkbox so that I can select only the ones
I
  want to show on the site. My problem is when I call the page I want the
  checkboxes that were previously chosen to show on the page as already
being
  selected so that the person can easily see what Testimonials are already
  being shown.

  Any ideas on how I can do this... I have been trying to loop though the
  selected testimonials and then do a <cfif> statement to compare values to
  the list output. But I only get one to show as selected instead of all of
  three out of 20 like I want.

  Hope this makes scene... below is some of my code I'm using if you need to
  see it.

  Thanks,
  - Neal
  ---------------------Code-----------------
  <CFSTOREDPROC procedure="LookUpAgentLinks" datasource="agenttemplate">
    <CFPROCPARAM type="IN" dbvarname="@EntityID" value="#agEntityID#"
  cfsqltype="CF_SQL_CHAR">
    <CFPROCPARAM type="IN" dbvarname="@BtnType" value="TMOL"
  cfsqltype="CF_SQL_VARCHAR">
    <CFPROCRESULT name="TestimonialChecked">
  </CFSTOREDPROC>

  <cfquery name="Testimonials" datasource="agenttemplate">
  SELECT * FROM dbo.Testimonials ORDER BY ID ASC
  </cfquery>

  <cfscript>
  Testimonials_NumRows = 0;
  Testimonials_Index = 1;
  HLooper1_NumRows = -2;
  Testimonials_NumRows = Testimonials_NumRows + HLooper1_NumRows;
  </cfscript>

  --------BODY--------
  <table>
  <cfset endrw=Testimonials_Index-1>
  <cfset HLooper1_numberColumns=2>
  <cfset numrows=-1>
  <cfloop condition="numrows is not 0 and endrw less than
  Testimonials.RecordCount">
  <cfset startrw=endrw + 1>
  <cfset endrw=endrw + HLooper1_numberColumns>
  <tr align="center" valign="top">
  <cfloop query="Testimonials" startrow="#startrw#" endrow="#endrw#">
  <cfoutput>
  <td width="251">
  <input type="checkbox" name="Testimonial#Testimonials.ID#"
  value="#Testimonials.ID#" >
  </td>
  </cfoutput>
  </cfloop>
  </tr>
  <cfset numrows = numrows - 1>
  </cfloop>
  </table>
  ------/BODY------
  -------------END CODE---------------------

  _____  


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

Reply via email to