Have an idea?

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

Grid question exclusive responses

I have grid questions where I ask a responded to fill in a numeric value, and then give radio button select questions for "don't know/ not sure" and "did not discuss option"

How can I make it so the respondent either answers the numeric grid question or the select grid question but not both/all?

Or have an error message that pops up if they fill in a value for the numeric response and clicks one of the select responses
asked Jan 1 by kaitlan

1 Answer

+2 votes
 
Best answer
If you want to unselect the radio button when numeric response is entered and clear the numeric response when radio button is selected, please use below code questions footer.
<script type="text/javascript">
$(".numeric_input").keyup(function(event) {
    if($(this).val()!="")
    {
        SSI_SetSelect("Check_1",false);
    }
});
function SSI_CustomGraphicalRadiobox(GraphicalRadioboxObj, InputObj)
{
    if(InputObj.id == "Check_1")
    {
        $(".numeric_input").val("");
    }
}
</script>


For validation you can use

if($("#NumCheck").val()==""&& SSI_GetValue("Check"))
{
    strErrorMessage="You forgot to answer this question.";
}


Replace NumCheck with respective numeric grid question variable and Check with radio button select question name.
answered Jan 2 by KarthikMahankali Bronze (2,990 points)
selected Aug 2 by Rajesh Rana
I added this to the question footer and it didn't work... did I do something wrong?

<script type="text/javascript">
$(".numeric_input").keyup(function(event) {
    if($(this).val()!="")
    {
        SSI_SetSelect("c10a1_r2=1",false);
    }
});
function SSI_CustomGraphicalRadiobox(GraphicalRadioboxObj, InputObj) {
    if(InputObj.id == "c10a1_r2=1")
    {
        $("#c10a1_r1_c1").val("");
    }
}
</script>
I removed the =1's and it still isn't working... Anything else I can try?
Thanks

<script type="text/javascript">
$(".numeric_input").keyup(function(event) {
    if($(this).val()!="")
    {
        SSI_SetSelect("c10a1_r2",false);
    }
});
function SSI_CustomGraphicalRadiobox(GraphicalRadioboxObj, InputObj) {
    if(InputObj.id == "c10a1_r2")
    {
        $("#c10a1_r1_c1").val("");
    }
}
</script>
Sorry for delayed response. As I was completed occupied these days, I was unable to reply this.

Answered below for your query so that you may use further.

Change the below
if(InputObj.id == "c10a1_r2")
to
 if(InputObj.id == "c10a1_r2_1")

Thank you!
...