Have an idea?

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

"Exclusive" radio button in a grid

Hello, everyone.

I have a grid question. Three rows, one column. The first and the second rows are numerical, the last row - radiobutton . I need to make  the radiobutton "exclusive" - if it is checked - the value  of numerical rows must be set to zero.

Thank you in advance.
asked Mar 12 by Vasyl Bronze (725 points)

1 Answer

+1 vote
Best answer
The problem with using radio buttons for a task like this is that respondents have no way to "unclick" the radio button once it is clicked.  I prefer to use checkboxes for tasks like this so respondents don't become stuck.

The Community Question Library's "Not Applicable: Per Question" can be used to add a checkbox underneath a question, requiring respondents to either answer the original question or check the checkbox.


Alternatively, "Not Applicable: Per Variable" can be used to add the checkbox directly to the grid question's table.


Will one of these serve your needs?
answered Mar 12 by Zachary Platinum Sawtooth Software, Inc. (108,875 points)
selected Mar 12 by Vasyl
Dear  Zachary,

Many thanks for your reply. I will try this approach.


It seems to me that this code will work (Q10 the name of the question)

var input1 = SSI_GetFormObject("Q10_r1_c1");
input1.onchange = function() {Change();}

var input2 = SSI_GetFormObject("Q10_r2_c1");
input2.onchange = function() {Change();}

function Change(){
    if(SSI_GetValue("Q10_r1_c1") != "0" || SSI_GetValue("Q10_r2_c1") != "0" ){
        SSI_SetSelect("Q10_r3_c1", false); 

function SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck){

    if(InputObj.name == ("Q10_r3_c1") && blnCheck == true){
        var input1 = SSI_GetFormObject("Q10_r1_c1"); 
        input1.value = "0";
        var input2 = SSI_GetFormObject("Q10_r2_c1"); 
        input2.value = "0";

If you're more comfortable using your own script, that's fine.  No better way to learn JavaScript than by practicing with it.

Remember that SSI_GetValue will return 0 both when the input element is empty ("") and when it set to the actual value of zero ("0").  If you end up needing the behavior to differ between these two states, you'll need to read the value from the input element directly rather than use SSI_GetValue.
Dear  Zachary,

Many thanks for your detailed and valuable comments.