Have an idea?

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

Display slider value

I am using a semantic differential question (just a single slider) and I would like to simply display the value selected by the respondent.

Do we have a simple solution for this?

I viewed various slider features in the Question Library but they appear to be attending to other problems.

Whilst on this occasion I am using the single slider, I would prefer to have a solution for both the single and multiple sliders within the same question.
asked Apr 7, 2020 by Paul Moon Platinum (94,725 points)
Doesn't the single value slider question in the CQL suit those needs?  What about it is wrong?
That's what I was checking on Zachary. Did any of the options in the Question Library resolve this issue? The reference you made appears to be a multi slider approach and I wasn't sure if it deals with single sliders?

In saying that, I would like a single slider and a multi slider solution where the respondent can see the values change as they move the anchor.

Nate sent me an ssi file to review. Not sure if this is a solution for both single and multi sliders? I will check this out over Easter and report back to you / Nate.

1 Answer

0 votes
Paul, i think this piece of code might work for your requirement

$( ".slider_container" ).on("slide", function( event, ui ) {
    var value = ui.value;
    $(this).find(".ui-slider-handle").html("<span class='slval'>"+value+"</span>");
});
answered Apr 8, 2020 by KarthikMahankali Bronze (4,780 points)
Wonderful. Thanks so much.

That did the job.

Happy Easter. Take care, stay safe.

Regards Paul.
Happy Easter Paul..
Hi Karthik. Hope you are well my friend.

Just one last improvement I was hoping to make on this.

So far, you have provided some very nice solutions. Thanks very much.

The last improvement I would like to make (if possible), is when the page loads, the anchor for all sliders are sitting in the middle on "0". That's fine as I am happy with that. If I click a value on the slider, the anchor moves and the value displays nicely. The only time the value does not display is when I click the anchor to remain on "0". Is it possible for "0" to display?

Note that the respondent must click on every slider to move to the next survey page. Also note that if I click a value like +2 or -3 and then click "0", the "0" is displayed just fine. The "0" does not display if I simply click on it when the page loads.

If you have any further questions, please let me know.

Thanks once again for your friendly assistance.

Regards Paul.
I didn't have a clue on this request Paul.

Only thing that came to my mind is making it display as '0' on page load uisng below snippet of code.
$(document).ready(function(){
    $(".ui-slider-handle").html("<span class='slval'>"+0+"</span>");
});


But I don't think it is apt because, even though it is displayed as '0' in back end the variable will be empty and respondent will be forced to answer if he/she tries to move forward without clicking or moving the slider and respondent may get confused with this.

However I will give a try in my free time and will get back to you if found any clue for this requirement.

Regards,
Karthik
That solution is "nice to know" as it almost does the job. It's handy to have.

The best solution no doubt is to have every slider answered and if they do click on a "0" immediately for any slider, it would be nice to have "0" appear for that particular slider. Right now that does not happen.

If you do find a solution, please send it on. Much appreciated.

Thanks so much, Paul.
...