The mfCsSliders function converts a Qualtrics Slider question into a Mobile-friendly constant sum slider question. This function was created because Qualtrics constant sum sliders are NOT mobile-friendly.
Functionality includes:
Example:
This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.
Add the mfCsSliders function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit →
and paste the provided mfCsSliders function JS:
<script>/*Paste mfCsSliders function JS here*/</script>
Alternatively, paste the mfCsSliders function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
Add JS to call the mfCsSliders function to apply it to the Slider question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
mfCsSliders(this);
});
To override the default options, specify the desired options in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
mfCsSliders(this,{mustTotalFlag:false});
});
If mustTotalFlag is true, then custom validation should be added. One validation condition is needed - the first slider should equal the mustTotalAmt minus remaining sliders. Use a math expression to the right of the “Is Equal to” condition something like:
$e{ 100 - q://QID1/ChoiceNumericEntryValue/2 - q://QID1/ChoiceNumericEntryValue/3 }
When the rows of the slider are conditional through the use of carry forward, display logic, or advanced randomization it may be necessary to use a hidden text entry question immediately after the slider question and base the slider custom validation on that question. The following code can be used to update the text entry question with the slider total:
Qualtrics.SurveyEngine.addOnload(function() {
mfCsSliders(this);
var q = jQuery("#"+this.questionId);
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
var sum = 0;
q.find(".ResultsInput").each(function() { sum += Number(this.value) });
q.nextAll(".QuestionOuter:first").find(".InputText").val(sum);
});
});
labelStyle is an object that specifies css style of the scale labels.
Default: {"font-weight":"bold"}
mustTotalAmt is a numeric value that specifies what the constant sum must total to when mustTotalFlag is true.
Default: 100
mustTotalFlag is a boolean that specifies if the constant sum must total to a specific value.
Default: true
prefix is text that is shown before numeric values.
Default: ""
suffix is text that is show after numeric values.
Default: "%"
widths is the width of the constant sum numbers in ems. An 'em' is the width of a wide character (i.e., M).
Default: 3