Have an idea?

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

Ranking question with an exclusive option

I have a ranking question containing 7 options and 1 None option. I need respondents to either rank or select none but not both.
What is the most effective way to achieve this?
I have added a select type question and have added below code in the advanced tab.

if ((SSI_GetValue("Q93_1") == 0) && (SSI_GetValue("Q93_2") == 0) && (SSI_GetValue("Q93_3") == 0) && (SSI_GetValue("Q93_4") == 0) && (SSI_GetValue("Q93_5") == 0) && (SSI_GetValue("Q93_6") == 0) && (SSI_GetValue("Q93_7") == 0) && (SSI_GetValue ("S12BNone_1") == 0))
{
var strErrorMessage = "You must either rank OR select Don't Know";
}
if (((SSI_GetValue("Q93_1") <> 0) || (SSI_GetValue("Q93_2") <> 0) || (SSI_GetValue("Q93_3") <> 0) || (SSI_GetValue("Q93_4") <> 0) || (SSI_GetValue("Q93_5") <> 0) || (SSI_GetValue("Q93_6") <> 0) || (SSI_GetValue("Q93_7") <> 0)) && (SSI_GetValue ("S12BNone_1") == 1)))
{
var strErrorMessage = "You must enter valid ranks OR select Don't Know, NOT BOTH";
}
asked May 9, 2017 by Tarun

1 Answer

+1 vote
This adds a checkbox beneath any other question and requires respondents either check the checkbox or answer the question:

http://sawtoothsoftware.com/community-question-library/1747-not-applicable-per-question
answered May 9, 2017 by Zachary Platinum Sawtooth Software, Inc. (83,675 points)
Would it be also possible to adapt the verification question, so that only one radio button needs to be selected (if one of the rows is "applicable") to proceed instead of having to select one radio button in each row?
Modified verification:

var applicableRow = 1;

var question = $('#[% QuestionName() %]_div').prevAll('.question')[0].id.replace(/_div/, '');
var qdiv = $('#' + question + '_div');
var err = !SSI_GetValue('[% QuestionName() %]_1') && !SSI_GetValue(question + '_r' + applicableRow);

// Error
$(qdiv).removeClass('error_quest_highlight2');
$('#' + question + '_err2').remove();

if (err) {
    strErrorMessage = 'Question must be answered or "Not Applicable" must be selected.';

    $(qdiv).removeClass('error_quest_highlight');
    $('#' + question + '_err').remove();
    $(qdiv).addClass('error_quest_highlight2');
    $(qdiv).prepend('<div id="' + question + '_err2" class="question_error_box error_messages"></div>');
    $('#' + question + '_err2').append('<div class="question_errors">' + strErrorMessage + '</div>');
}


Line 1 must be updated to the row number to be given special functionality.
Thank you Zachary! Using this verification code, I need to assume that one of the rows is selected in any case (here: Row 1); Is it possible to make the verification independent on the row the respondent chooses - its just necessary to select at least one radio button?
To specify further: The respondent needs to select the checkbox "not applicable" or he needs to choose at least one radio button within the 7x2 grid (row orientation) - which radio button / row the respondent selects does not matter. Is this possible to incorporate in the verification?
Replace line 5 with this:

var err = !SSI_GetValue('[% QuestionName() %]_1') && !SSI_GetValue(question + '_r1') && !SSI_GetValue(question + '_r2');
...