Have an idea?

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

Graying out Levels in ACBC holdouts

Dear Forum,

I have included 3 holdouts (with 3 concepts each) in my survey and I'd like to gray out the same levels so it looks more like the other ACBC tasks. Is there a code or function to do so in Sawtooth 9.4?

Thanks,
Benedikt.
related to an answer for: Holdout cards within ACBC
asked Oct 21 by Benedikt

1 Answer

0 votes
Place this code in the CBC:

<style>
[% Begin Unverified Perl
my $attributes = 4;
my $concepts = 3;

my $out = '';
for (my $a = 1; $a <= $attributes; $a++) {
    my $same = 1;
    my $first = CBCDESIGNLEVELVALUE(QUESTIONNAME(), 1, $a);
    for (my $c = 2; $c <= $concepts; $c++) {
        my $this = CBCDESIGNLEVELVALUE(QUESTIONNAME(), $c, $a);
        if ($first != $this) {
            $same = 0;
            last;
        }
    }
    if ($same) {
        if ($out ne '') {
            $out .= ',';
        }
        $out .= '#' . QUESTIONNAME() . '_div .cbc_concept > .cbc_cell:nth-child(' . $a . ')';
    }
}
return $out;
End Unverified %] {
    background-color: lightgray;
}
</style>


Lines 3 and 4 must be updated with the number of attributes and concepts in each task.  Line 26 can be updated with your preferred background color.
answered Oct 23 by Zachary Platinum Sawtooth Software, Inc. (63,875 points)
That is amazing, thanks! I am sorry to ask again but where exactly can I add the code in the CBC Task. I cannot find the HTML input box.

Thanks in advance,
Benedikt
Anywhere in the task.  I put the code in the footer.
Hi Zachary,
thanks for the quick reply. Unfortunately when I copy paste the code in the footer (or anywhere else) and then preview the page, my laptop gets very noisy and the sawtooth software crashes. Do you know what I am doing wrong?
Cheers,
Benedikt
That is quite abnormal.  What version of SSI Web / Lighthouse Studio are you using?  Is there an error message when the software crashes?
...