Custom Validation for Graphic Slider Question | XM Community
Skip to main content

Hi All,

The Graphic Slider Question only works on a 5pt scale and I need to change this to 4pt. I'm aware changing the quesiton type might lose my data so I need to find a solution which changes this to point and forces the responder to not pick the middle point ie. pt 3.
There is no validation available so I'd like to do this via some code. and hide the middle face (done that bit!)

I found some code here: https://community.qualtrics.com/XMcommunity/discussion/10637/custom-validation-side-by-side as my starting point and am trying to figure out the class / IDs needed to listen in on the value selected and if it's the middle value when you submit the page to force a validation message appear and set the value back to zero so that you can't move on.

Can anyone help guide me on this?

Thanks

Rod Pestell

Qualtrics.SurveyEngine.addOnload(function()
{
//to hide the middle smiley face - it works ok but would be nice to make this be hidden straight off
//rather than it to display for a split second
jQuery(".SSImage.Smile.SS3").css({visibility:'hidden'});

});

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
//I'm trying to check / display the number selected in the console but that's not working
console.log("value:" + this.value);

var q = jQuery("#"+this.questionId);
var ve = q.find(".ValidationError");

//I'm not sure if .BarContainer is right and also the .on bit probably isn't right for a slider object//
q.find(".BarContainer").on("blur", function(e) {
    if(this.value = 3) {
        ve.html("Please move the slider either to the right or left");
        ve.show();
        this.value = "";
}
});

});

Be the first to reply!

Leave a Reply