CatherineL
CatherineL

Reputation: 67

How to get the cfdiv to display under each line?

I have a table of records and the user can click on a name to show more detailed information about that certain record. I have it set up with a tag but each time the link is clicked it only shows up on the top of the page or the very first row. Is there a way to get it to show under each name when it is click. Here is the code I have...

<table width="75%" border="1">
  <tr>
    <th>Student Name</th>
  </tr>
  <cfoutput query="Q">
  <tr>
    <td><a href="javascript:ColdFusion.navigate('detailedRecord.cfm?RLN=#RLN#','detail')">#Q.sln#, #Q.sfn#</a></td>
  </tr>
  <tr>
    <td><cfdiv id="detail"></cfdiv></td>
  </tr>
  </cfoutput>
</table>

Upvotes: 1

Views: 79

Answers (1)

Miguel-F
Miguel-F

Reputation: 13548

Since you are in a loop <cfoutput query="Q"> you will need to make detail a unique identifier. As you have it written every iteration of your loop has the same id. Maybe just add the current row number to make it unique.

<table width="75%" border="1">
  <tr>
    <th>Student Name</th>
  </tr>
  <cfoutput query="Q">
  <tr>
    <td><a href="javascript:ColdFusion.navigate('detailedRecord.cfm?RLN=#RLN#','detail#Q.CurrentRow#')">#Q.sln#, #Q.sfn#</a></td>
  </tr>
  <tr>
    <td><cfdiv id="detail#Q.CurrentRow#"></cfdiv></td>
  </tr>
  </cfoutput>
</table>

Upvotes: 4

Related Questions