Have an idea?

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

Outline Row for Error message for Semantic Differntial with NA per variable

I've had a request here regarding the error message if they didn't select a response or select the don't know for each row.  Is there a way to have the row(s) that are missing a response highlighted/outlined in red or something so they stand out.  There are 19 rows and my client is concerned about it being difficult to see which is missing an answer.

Added from post: https://www.sawtoothsoftware.com/forum/15858/semantic-differential-slider-with-dont-know
asked Nov 3 by Jay Rutherford Gold (21,905 points)

1 Answer

0 votes
Lighthouse's built-in verification turns on and off the ".error_var_highlight" class on its own, so let's start off by creating our own class so we won't potentially conflict with built-in verification.  Add this CSS anywhere on the page:

<style>
.error_var_highlight2 {
    border: 1px solid red !important;
}
</style>


Next, I totally reworked the for loop in the custom JavaScript verification.  Replace the loop with this:

list.forEach(function(item){
    if (!SSI_GetValue(question + '_' + item) && !SSI_GetValue('[% QuestionName() %]_' + item)) {
        err = true;
        $('#' + question + '_' + item).addClass('error_var_highlight2');
    }
});


If a respondent fails to answer the question correctly multiple times in a row, we don't want the error highlighting to persist from one failed answer to the next, so add this to the verification anywhere before the forEach loop:

$('.error_var_highlight2').removeClass('error_var_highlight2');


Hopefully this will add sufficient visual clarity for your client.
answered Nov 3 by Zachary Platinum Sawtooth Software, Inc. (63,775 points)
I think that looks great!  All is working well.  I'll pass it on and see if my client is okay with it.  Thanks!
...