Have an idea?

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

Custom error code for grid question to restrict rows that can be selected

I'm trying to create a custom error message for a grid question that is column-oriented. The first column asks how many total items a respondent consumes, and the second column asks how many of one subset of items a respondents consumes.

For example, this means that if they select 3-5 total items (row 2) for column 1, they shouldn't be able to select 5-7 subset items (row 3) for column 2. Instead, they should only be able to select rows 2 or 1 for column 2 (aka the row selected in col 1 and any lower rows).

thanks in advance for the help!
asked Mar 11 by anonymous

1 Answer

0 votes
This custom JavaScript verification should do the trick:

if (SSI_GetValue('[% QuestionName() %]_c2') > SSI_GetValue('[% QuestionName() %]_c1')) {
    strErrorMessage = 'Error.'
}
answered Mar 12 by Zachary Platinum Sawtooth Software, Inc. (144,125 points)
...