Have an idea?

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

changing response

When I am testing a survey, I cannot change the response on a select question (for example in the case that is not  a response required) and I want to delete response. Any ideas on how to make this possible?
asked Jan 8 by sallen (460 points)
Radio buttons by default have no way to be unanswered, but such functionality can be implemented with a bit of JavaScript.  I've seen users go a few different ways:

* Adding a button to the page that clears the response when clicked on.
* Making it so clicking on a checked radio button unchecks it.
* Adding a checkbox beneath the question that clears and disables the radio buttons when it is checked.

Do any of those sound like they'd work for you?
Thanks, Zachary!  It would love to have it so they can click again to uncheck it.  Do you have examples of that javascript you can share?
The code below seems to be working. Thanks!

1 Answer

0 votes
 
Best answer
Here's some quick code that should add this behavior to all graphical radio buttons on the page:

<script>
$(document).ready(function(){
    var resps = {};
    $('input[type="radio"]').each(function(){
        var name = $(this).attr('name');
        if (!resps.hasOwnProperty(name)) {
            resps[name] = SSI_GetValue(name);
        }
    });
    
    SSI_CustomGraphicalRadiobox = function(graphical, input) {
        var name = $(input).attr('name');
        var resp = SSI_GetValue(name);
        if (resp != 0 && resp == resps[name]) {
            SSI_RadioReset(name);
            resp = 0;
        }
        resps[name] = resp;
    };
})
</script>
answered Jan 8 by Zachary Platinum Sawtooth Software, Inc. (161,250 points)
selected Jan 8 by sallen
...