Have an idea?

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

How to add a 'Not applicable' checkbox

Hello,  I have a grid with 2 columns.  My client would like a not applicable checkbox.  So if the not applicable checkbox is checked than the radio buttons selected in the 2 columns will de-select.

I have added the 'Not applicable' question for the library but this only de-selects the radio button in the first column.

In addition, the radio button selected in column 1 can not be the same as the radio button selected in column 2.

I have applied the following code


if (SSI_GetValue('[% QuestionName() %]_c1') == SSI_GetValue('[% QuestionName() %]_c2')) {
    strErrorMessage = 'Error';
}



and this is not working with the not applicable question

Can someone help me.

Thank  you in advance.
asked Jul 26 by Sandy
I'm unable to reproduce the behavior you mention about Not Applicable only clearing one column of the grid question.  Can you send a copy of your .ssi demonstrating this problem to support@sawtoothsoftware.com?  Any sensitive or irrelevant information could be removed from the questionnaire before sharing it.

As for your custom JavaScript verification, the error message appears when the respondent selects not applicable because the responses to column 1 and column 2 are the same (both 0).  To fix this, we just need the verification to only show the error if the columns have actually been answered:

var c1 = SSI_GetValue('[% QuestionName() %]_c1');
var c2 = SSI_GetValue('[% QuestionName() %]_c2');
if (c1 != 0 && c1 == c2) {
    strErrorMessage = 'Error';
}
Sandy, please include "Disable Graphical Inputs" on this questionnaire page:

https://sawtoothsoftware.com/community-question-library/1739-disable-graphical-inputs

1 Answer

0 votes
Hi Sandy,

My solution is probably not elegant (Zachary could come up with much better I'm sure) but:

I would add a separate question below the grid with the "Not applicable", as a multi-select with only one option (no answer forced).  Then make the grid no required response.

And with the functions SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck) and SSI_RadioReset handle the "if Not applicable clicked then reset each column of the grid".

To be complete you would also need to: if either Grid columns is clicked, reset the N/A.
With the SSI_CustomGraphicalRadiobox(GraphicalRadioObj, InputObj) and SSI_SetSelect functions.

And finally add an error message in case neither all grid columns are answered, or the N/A is not checked (so that the respondent must provide an answer).

Let me know if you need more details.

Cheers
answered Jul 27 by amic Bronze (1,030 points)
...