Have an idea?

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

Uncheck the radio button in a grid.

Here's the situation, I made a grid question and its question direction is rows.

Since you only have to check the radio button in each row which you're interested, how may I uncheck the radio button when I mistakenly select one which is not the row I want?

E.g., we always have an 'Others: ____ ' option as the last row, if people somehow jumps into that row, we can't uncheck the radio button and people are forced to write something in others, which is definitely not we'd like to see.
asked Nov 3 by anonymous
The JavaScript function SSI_RadioReset exists to reset a group of radio buttons, but it needs to be attached to a JavaScript event.  In other words, what does the respondent do to indicate that they want the radio buttons reset?  Should there be a button at the end of the rows to reset them?  Do the radios automatically reset when the respondent clears the other specify field?  Something else?
If respondents click the button which has already been checked, it could be a trigger that people would like to uncheck it. Could this be done on Sawtooth using SSI_radioReset?

By the way, could you provide more specific steps using Javascript functions since I'm new to Sawtooth?

1 Answer

0 votes
Place this code in the grid question's footer:

<script>
var radioResps = {};

$(document).ready(function(){
    $('input[name="hid_row_list_[% QuestionName() %]"]').val().split(',').forEach(function(row){
        radioResps['[% QuestionName() %]_r' + row] = SSI_GetValue('[% QuestionName() %]_r' + row);
    })
})

function SSI_CustomGraphicalRadiobox(graphical, input) {
    if (radioResps[input.name] == input.value) {
        SSI_RadioReset(input.name);
    }
    radioResps[input.name] = SSI_GetValue(input.name);
}
</script>
answered Nov 6 by Zachary Platinum Sawtooth Software, Inc. (63,475 points)
...