4 Replies Latest reply on Mar 19, 2008 7:10 AM by wfu_king

    dynamic ratings

      I am trying to present several questionnaires to subjects. Within some of these questionnaires are lists of adjectives which they will rate with the same 7-point scale (radio buttons). I have to randomize the list of adjectives when presented. I've been able to accomplish this by putting my lists of questions (adjectives) in separate MySQL tables then query the tables with random order. However, I'm stuck now trying to figure out how I can get the radio buttons to work with each adjective on the list while tracking which answer (radio button) the subject is answering - which adjective does this answer go with? I wondered about putting an additional field in the adjectives table to represent the answer, but that doesn't get me anywhere. Here's my code so far:

        • 1. Re: dynamic ratings
          DCwebGuy Level 1
          Assuming you only want ONE value response per qtext, I would simply replace the radio names with the qtext variable itself, then parse them out on the backend, so something like this:

          <form id="form1" name="form1" method="post" action="">
          <table border="1">
          <cfoutput query="getSelfAdj">
          <td><label><input type="radio" name="#qtext#" id="radio1" value="1" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio2" value="2" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio3" value="3" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio4" value="4" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio5" value="5" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio6" value="6" /></label></td>
          <td><label><input type="radio" name="#qtext#" id="radio7" value="7" /></label></td>

          When submitted, it would result in this:

          name="[whatever #qtext# is]" value="[1-7]"

          Is this what you're looking for?
          • 2. Re: dynamic ratings
            wfu_king Level 1
            Thanks DCWebGuy! That's exactly what I needed. Works perfectly. Don't know why it didn't occur to me.
            • 3. Re: dynamic ratings
              wfu_king Level 1
              This solution worked perfectly for the ratings. However, now I have a somewhat different page where I am getting a list of names from a query and presenting the names in the table. Then the user will rate each of these "targets" with a 7-point scale. I thought I had it when I set it up the same way as with the above. The problem is that the usernames become my field names....I need the usernames to be the values instead......like the #qtext# is the value above. This seems easy, but it's not coming to me.

              The number of users from the query results will vary. The results will be inserted into a table with the following fields:

              ansID(key), username (this is person doing the rating - get this from session), target (this is the username I want to get)
              • 4. Re: dynamic ratings
                wfu_king Level 1
                Just "unanswering" for now.