- Posts: 5
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
{if(is_empty(B2),rand(1,3),B2}
Option B Brand: {if(B1==1,"BMW","Mercedes")} Color: {if(B2==1,"red", if(B2==2,"green","yellow"))}
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;"> <tbody> <tr> <td bgcolor="#f2f2f2" style="text-align: center;" width="0%"> </td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">A</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">B</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;" width="25%"><strong><span style="color:#000000;"><span style="font-size:20px;">C</span></span></strong></td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Infrastructure Type</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage1}.jpg" /></td> <td style="text-align: center;" width="1%"> </td> <td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage2}.jpg" /></td> <td style="text-align: center;" width="1%"> </td> <td><img src="/lime3/upload/surveys/877122/images/Hamburg-Ballett_{rImage3}.jpg" /></td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Travel Time</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomTime1==1,'15 min',if(randomTime1==2,'20 min', if(randomTime1==3,'25 min', if(randomTime1==4,'30 min','35 min'))))}</td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomTime2==1,'15 min',if(randomTime2==2,'20 min', if(randomTime2==3,'25 min', if(randomTime2==4,'30 min','35 min'))))}</td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomTime3==1,'15 min',if(randomTime3==2,'20 min', if(randomTime3==3,'25 min', if(randomTime3==4,'30 min','35 min'))))}</td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="color:#000000;"><span style="font-size:18px;">Speed Limit</span></span></strong></td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomSpeed1==1,'20 mph',if(randomSpeed1==2,'25 mph', if(randomSpeed1==3,'35 mph','40 mph')))}</td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomSpeed2==1,'20 mph',if(randomSpeed2==2,'25 mph', if(randomSpeed2==3,'35 mph','40 mph')))}</td> <td style="text-align: center;" width="1%"> </td> <td style="text-align: center;">{if (randomSpeed3==1,'20 mph',if(randomSpeed3==2,'25 mph', if(randomSpeed3==3,'35 mph','40 mph')))}</td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"><strong><span style="font-size:18px;"><span style="color:#000000;">Your Choice</span></span></strong></td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> </td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> </td> <td style="text-align: center;" width="0%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> </td> </tr> </tbody> </table> <script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Move the radios $('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion)); $('.question-text table:eq(0) tr:last td:eq(4)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion)); $('.question-text table:eq(0) tr:last td:eq(6)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(2) *', thisQuestion)); // Some classes for presentation $('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio'); $('.question-text table:eq(0) .radio-item label', thisQuestion).show(); // Click event on the table cells $('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) { $('input:radio', this).trigger('click'); }); $('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) { e.stopPropagation(); }); // Clean-up styles $('.answer-container', thisQuestion).hide(); $('.question-text table:eq(0) .label-text', thisQuestion).remove(); $('.question-text table:eq(0) .radio-text', thisQuestion).css({ 'cursor': 'pointer' }); }); </script>