Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Screening task format

Hello,

You have below the code I used to add headers to the 4 different product configurations displayed in my ACBC survey

<script>
$(document).ready(function(){
    var topRowHtml = '<tr><td></td>';
    topRowHtml += '<td><center><strong>Configuration 1</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration 2</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration 3</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration 4</strong></center></td>';
    topRowHtml += '</tr>';
    $('.acbc_screener > .question_body > table > tbody').prepend(topRowHtml);
})
</script>

1) I wanted to use "pagenumber()" to be able to have continuous headers : Configuration 1, ..., Configuration 4, Configuration 5 (on the second screening task screen), ..., Configuration 8 instead of Configuration 1,...,Configuration 4 on all screening tasks

2) Would someone know how to add a top line to my headers ? (using a "border: 1px solid black" but I did not manage to do it so far...

Many thanks for your help on these two questions !
asked Nov 8 by luclepage2017 (185 points)

1 Answer

+1 vote
For your first request, you can use PageNumber or ACBCCurrentScreener and a bit of arithmetic to print out the numbers the way you want.

You could probably achieve your second request by changing some borders with CSS, but it might be easier to just move the ".acbc_task_top_row" from the old top row to the new top row.

<script>
$(document).ready(function(){
    var baseConfig = ([% ACBCCurrentScreener() %] - 1) * 4;
    var topRowHtml = '<tr class="acbc_task_top_row"><td></td>';
    topRowHtml += '<td><center><strong>Configuration ' + (baseConfig + 1) + '</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration ' + (baseConfig + 2) + '</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration ' + (baseConfig + 3) + '</strong></center></td>';
    topRowHtml += '<td><center><strong>Configuration ' + (baseConfig + 4) + '</strong></center></td>';
    topRowHtml += '</tr>';
    $('.acbc_task_top_row').removeClass('acbc_task_top_row');
    $('.acbc_screener > .question_body > table > tbody').prepend(topRowHtml);
})
</script>
answered Nov 8 by Zachary Platinum Sawtooth Software, Inc. (63,900 points)
Thanks a lot for your help Zachary!
...