Have an idea?

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

To create Highlighting Question

Hi, guys, hope you are doing well.

Currently using SSI Web, version  8.4.8

There is need to create highlighting question, where the text will be shown for respondents, so they choose some words or phrases from this given text.

In the end I must see in SPSS database, which words or phrases were chosen.

I wonder how to realise it.

Thanks a lot for your attention so far.

BR,
Ainur.
asked Aug 8 by aissabek (120 points)
Click on this link ...

http://www.sawtoothsoftware.com/community-question-library/1746-highlighting

This is a text hi-lighting question you can download from the Question Library that Zachary Anderson has so neatly put together.

I'm not sure you can use this in v8.4.8? You can certainly use it in Lighthouse Studio v9.

I would double check it's range of use with Sawtooth Software directly at support@sawtoothsoftware.com.

1 Answer

0 votes
hello Ainur,

i suppose you are looking for click and highlight solution (i.e, for example showing a profile to the respondent and asking him to select the text / area which positively influence them or negatively influence them. We will be storing his responses in the back end, based on number of clicks hit by the respondent)

positive influence : 1 click
negative influence : 2 clicks
undo selections : 3 clicks  

we can create this in a free format question.

1) create the number of hidden variables that you need
2) declare them
ex : <tr >
        <td colspan="2" id="a1" class="col">xxxxxxxxxxxxxxxxxxx<input name="[% QuestionName() %]_a1" id="[% QuestionName() %]_a1" type="hidden""></td>
    </tr>

3) we need to place the following CSS & script codes

<style type="text/css">
.tborder, .tborder td
{
    border-color: #6A6A6A;
    border-width: 2px;
    border-style: solid;
}
.no_outer_border {
    border-collapse: collapse;
    border-style: hidden;
}

table.no_outer_border td, table.no_outer_border th {
    border: 2px solid #6A6A6A;
}
.red
{
    background-color: red;
    color: white;
}
.green
{
    background-color: lightgreen;
}
.lft
{
    text-align:left;
}
.page
{
    width:1100px;
}
.question
{
    width:1050px;
}
</style>

<script type="text/javascript">
var col="";
var cls_call;
var xp=0;

function Reset()
{
    xp=0,xa1=0;
    $(".question").find("input[type=hidden]").each(function(){
        $(this).val(0);
        id=$(this).attr("id").split("_")[1];
        $("#"+id+",."+id).removeClass("green");
        $("#"+id+",."+id).removeClass("red");
        $("div#c"+id).hide();
    });
}
function myFunction(id)
{
   
    xp=$("#[% QuestionName() %]_"+id).val();
    SSI_SetSelect("[% QuestionName() %]_ch_1",false);
    if(xp==0)
    {
        $("#"+id).addClass("green");
        if(cls_call) { $("."+id).addClass("green");    }
        $("#[% QuestionName() %]_"+id).val(1);
    }
    else if(xp==1)
    {
        $("#"+id+",."+id).removeClass("green");
        $("#"+id).addClass("red");
        if(cls_call) { $("."+id).addClass("red");    }
        $("#[% QuestionName() %]_"+id).val(2);
    }
    else if(xp==2)
    {
        $("#"+id+",."+id).removeClass("red");
        $("#[% QuestionName() %]_"+id).val(0);
    }
}
</script>

4) footer code:

<script type="text/javascript">
$(".question").find("input[type=hidden]").val(0);
$(".col").css('cursor','pointer');
/*Code to Reset the highlighted text when check box is checked*/
/*function SSI_CustomGraphicalCheckbox(GraphicalCheckboxObj, InputObj, blnCheck)
{
    if(blnCheck == true)
    {
        Reset();
    }
}*/
var count=0;
$(".col").click(function(){
    cls_call=false;
    if(this.id) { myFunction(this.id);}
    else{
        regExp = /\sa[0-9]+[\s]*/;            // to match ' a1' or ' a1 ' in class="col a1" or "col a1 lft"
        cls=$.trim(regExp.exec($(this).prop("classList"))[0]);
        cls_call=true;
        myFunction(cls);
    }
});
</script>

5) Validation code:

var i,c=0;
$(".question").find("input[type=hidden]").each(function()
{
    if($(this).val()>=1)
    {
        c=c+1;
    }
});
if(c==0 && count==0 && SSI_GetValue("[% QuestionName() %]_ch_1")==0)
    {
        count++;
        strErrorMessage=" ";
        $("#error_box").hide();
        $("#[% QuestionName() %]_div").removeClass("error_quest_highlight");
        var msg = 'You indicated that nothing in the profile influences you. Please click here to confirm and proceed to the next question.';
        var div = $("<div>" + msg + "</div>");
        $("#[% QuestionName() %]_div").unbind("click");
       
        div.dialog({
            width: 500,
            height:'auto',
            modal: true,
            draggable: false,
            closeOnEscape: false,
            resizable: false,
               title: "Confirm",
            buttons: [
                       {
                            text: "OK",
                            click: function ()
                            {
                                strErrorMessage="";
                                div.dialog("close");
                            }
                        },

                    ]
        });
    }
answered Aug 24 by Saritha potu Bronze (500 points)
...