Have an idea?

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

Select Question - Check boxes -Free Format

Hello,

I have a checkbox question with 18 response options .  12 minimum checks and 12 maximum checks.  My client would like for a message to pop-up when the 13 option is selected.  Is this possible?  I don't know how to do this.  I would appreciate any help.

Thank you
asked Sep 14, 2021 by Sandy
Can you elaborate on how the message is meant to work?  Is it an actual pop-up window or just some text that shows up somewhere?  Where?  Does the message go away after some time or once they're back under thirteen selections?

1 Answer

0 votes
Use this JavaScript code in footer and update 21st line with number of selections and 23rd with pop-up message

var nos=0;
function SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck)
{
    var id=InputObj.id;
    var id1=InputObj.id.split("_")[1]; 
    var other=$("#"+id).closest('div.input_cell').next().find(".open_end_text_box").attr("id");
    if(blnCheck==false && other)
    {
        $('#'+other).removeClass("x");
        $('#'+other).val("");
    }
    //var ind1=ar1.indexOf(id1);
    if(blnCheck==true)    
    {
        nos++;
    }        
    if(blnCheck==false)    
    {
        nos--;
    }
    if(nos>=2)
    {
        var msg = 'Your error message goes here.';
        var div = $("<div>" + msg + "</div>");
        div.dialog({
            width: 500,
            height:'auto',
            modal: true,
            closeOnEscape: false,
            resizable: false,
            draggable: false,
               title: "Confirm",
            buttons: [
                        {
                            text: "Yes",
                            click: function () 
                                {
                                    div.dialog("close");
                                }
                        },
                        {
                            text: "No",
                             click: function () 
                                {                               
                                    div.dialog("close");
                                }
                        }
                    ]
        });
    }
}
answered Sep 15, 2021 by KarthikMahankali Silver (5,050 points)
Thank you so much.. This is exactly what I was looking for.

All the best,
Sandy
Glad to know this solution helped you
...