Is it possible to change a table cell color based on a previous response?

I have a table with a list of animals.  Participant #1 selects what animals he/she owns.  At the end, the browser is closed before termination.  Participant #2 then uses the same user id and starts the survey over, thus is able to see Participant #1's data.  Is it possible that if Participant #1 selected rows 2, 3, and 4 that the cell color changes for Participant #2?
asked Jul 18, 2012 by anonymous
retagged Sep 13, 2012 by Walter Williams

2 Answers

0 votes
User id would be a password variable? This would let you leave off, but if you started over not sure you could see that data unless I'm missing something. Sometimes I'll save data to a text file named after the user ID with perl in these situations.

Assuming you can see that data, you can set the color of the animal cells based on a previous value with javascript.

In version 8/jQuery:

if ( parseInt("[% VALUE(OWNSANIMAL_r1) %)") === 1)
{
   $('MYQUESTION_div .clickable).each(function(index) {
    
    if (index == 0){$(this).css('background-color', 'red') }
  });
}
answered Jul 18, 2012 by anonymous
0 votes
If you are using a unique password to restart a survey, then logging back in takes you to where you last left off, i.e. when you closed the browser.  In order to see the answers, you would need to back up on each page, and when you re-submitted answers it would overwrite the first respondent's answers.

So, technically the answer is yes.  But it's not built into the software.  You would have to write something like PHP scripts to query your database (v8), and then use JavaScript or Perl or something to write some CSS and modify colors.

Given enough time and resources, you could program everything :)  But in this case, it would be a whole lot of work.
answered Jul 19, 2012 by Brian McEwan Silver Sawtooth Software, Inc. (8,850 points)