Have an idea?

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

categorisation

Hello,

In the categorization question I need to rank at least 1 answer.
How to force ranking for a single item ? No matter wich one ...

Best,
Stephane
asked Mar 18 by Stephane
You're talking about the Categorization question from the Community Question Library, correct?

Are you interesting in requiring EACH category have at least one item ranked, or that AT LEAST one category has at least one item ranked, or something else?
Hello Zachary,

Yes, I'm taking about the Categorization question from the Community Question Library.

I'm interesting in requiring "AT LEAST one category has at least one item ranked".

Best,
St├ęphane

1 Answer

0 votes
Please try this script:

var foundResponse;
var rowsList = $('input[name="hid_row_list_[% QuestionName() %]"]').val().split(',');
var colsList = $('input[name="hid_col_list_[% QuestionName() %]"]').val().split(',');
for (var r = 0; r < rowsList.length && !foundResponse; r++) {
    var row = rowsList[r];
    for (var c = 0; c < colsList.length && !foundResponse; c++) {
        var col = colsList[c];
        foundResponse = SSI_GetValue('[% QuestionName() %]_r' + row + '_c' + col);
    }
}
if (!foundResponse) {
    validationErrors.push('At least one item must be ranked in any category.');
}


It should be placed before this line in the custom JavaScript verification:

if (validationErrors.length) {
answered Mar 19 by Zachary Platinum Sawtooth Software, Inc. (120,400 points)
...