4 Replies Latest reply on Feb 22, 2014 9:06 AM by rickaclark54

    How do I get a button to show in a list only when a survey is filled?

    rickaclark54 Level 1

      I am using cf9 with mySQl 5+. I have two tables:

      1. Signups -  where people signup to take a course.
      2. Course_eval – once the course is completed, the student fills in the course evaluation


      I use an inner join on userID in both tables.


      I have a page, showsignups.cfm, that lists all of the students by course. Once a student finishes the survey, a button will show up next to the student in the showsignups.cfm page where it can be clicked on to show the survey by the individual student.


      My problem is instead of showing all students with or without the survey buttons, it only shows the students who have finished the survey. It should show:


      Student’s name | survey button

      Student’s name |

      Student’s name | survey button

      Student's name |


      I thought using a cfloop through the students would give me the effect I want, but alas, no. Here is the code I am using for the cfquery:


      <cfquery name="getsignups" datasource="#application.dsn#">

      select signups.courseTitle,signups.property,signups.calendardate,signups.company,signups.firstna me,signups.lastname,signups.email,signups.phone,signups.userID,signups.signup_id,signups.r id,course_eval.userID,course_eval.id

      from signups INNER JOIN course_eval ON signups.userID = course_eval.userID

      where signups.rid = #rid#



      (Rid is the courseID)


      Here is the output I am using:



      <cfloop query="getsignups">


      <td>#rid# - #firstname# #lastname#  |   <a href="mailto:#email#">#email#</a></td><td>Ph: #phone#</td>

      <td width="24"><a href="showsignups.cfm?signup_id=#signup_id#&go=go" class="button">Remove</a></td>

      <cfif isdefined("id")>

      <td width="24"><a href="../../forms/surveys.cfm?userID=#userID#" class="button">Survey</a></td>






      I know this is a long post, but I wanted to make sure any body who reads this understands what I am trying to accomplish. Any ideas on what I am doing wrong?