User Tools

Site Tools


mfcssliders

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mfcssliders [2022/09/05 11:17] – [Custom Validation] adminmfcssliders [2025/02/19 11:26] (current) – [Custom Validation] admin
Line 1: Line 1:
 ====== mfCsSliders - Mobile-friendly Constant Sum Sliders ====== ====== mfCsSliders - Mobile-friendly Constant Sum Sliders ======
-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: +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.  
-  * Support and automatic detection of Mobile and non-Mobile Friendly + 
-  * Control of minimum spacing between scale labels +Functionality includes:\\ 
-  * Turning display of the numeric scale on or off +  * Optionally turn "must total" on or off 
-  * Optional suppression of numeric scale minus signs +  * Set "must total" to any amount 
-  * Repeating of numeric scale +  * Dynamic total calculation with visual indicators when equal to or over "must total" amount 
-  * Highlighting of unanswered rows+  * Supports addition of prefixes or suffixes to numeric values (%, $, etc.) 
 +  * Supports formatting of scale style
  
 Example:\\ Example:\\
-Coming Soon+{{ ::mfcssliders.mp4?800 |mfCsSliders Example}}
  
-This function is available for a reasonable fee. Contact [[https://community.qualtrics.com/XMcommunity/messages/add/TomG|TomG]] on the Qualtrics Community to learn more.+This function is available for a reasonable fee. Contact **[[https://community.qualtrics.com/XMcommunity/messages/add/TomG|TomG]]** on the Qualtrics Community to learn more.
 ===== Set-up Instructions ===== ===== Set-up Instructions =====
 ==== Add Function To Survey ==== ==== Add Function To Survey ====
-To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag: +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 -> {{::icon_source.jpg?20|}} and paste the provided mfCsSliders function JS:
-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 -> {{::icon_source.jpg?20|}} and paste the provided mfCsSliders function JS:+
 <code> <code>
 <script>/*Paste mfCsSliders function JS here*/</script> <script>/*Paste mfCsSliders function JS here*/</script>
Line 28: Line 28:
 </code> </code>
  
-To override the default options, specify the desired options in the second function argument as an object. For example:+To override the default options, specify the desired **[[mfcssliders#Options|options]]** in the second function argument as an object. For example:
 <code> <code>
 Qualtrics.SurveyEngine.addOnload(function() { Qualtrics.SurveyEngine.addOnload(function() {
- mfCsSliders(this,{});+ mfCsSliders(this,{mustTotalFlag:false});
 }); });
 </code> </code>
Line 42: Line 42:
   * Mobile friendly: On   * Mobile friendly: On
 ==== Custom Validation ==== ==== Custom Validation ====
-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:+If **[[mfcssliders#mustTotalFlag|mustTotalFlag]]** is true, then custom validation should be added. One validation condition is needed - the first slider should equal the **[[mfcssliders#mustTotalAmt|mustTotalAmt]]** minus remaining sliders. Use a math expression to the right of the "Is Equal to" condition something like:
 <code> <code>
 $e{ 100 - q://QID1/ChoiceNumericEntryValue/2 - q://QID1/ChoiceNumericEntryValue/3 } $e{ 100 - q://QID1/ChoiceNumericEntryValue/2 - q://QID1/ChoiceNumericEntryValue/3 }
 </code> </code>
 +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:
 +<code>
 +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);
 + });
 +});
 +</code>
 +
 ===== Options ===== ===== Options =====
 ==== labelStyle ==== ==== labelStyle ====
 **labelStyle** is an object that specifies css style of the scale labels. **labelStyle** is an object that specifies css style of the scale labels.
  
-Default: {"font-weight":"bold"}+Default: %%{"font-weight":"bold"}%%
 ==== mustTotalAmt ==== ==== mustTotalAmt ====
-**mustTotalAmt** is a numeric value that specifies what the constant sum must total to when mustTotalFlag is true.+**mustTotalAmt** is a numeric value that specifies what the constant sum must total to when **[[mfcssliders#mustTotalFlag|mustTotalFlag]]** is true.
  
 Default: 100 Default: 100
-==== mustTotalAmt ====+==== mustTotalFlag ====
 **mustTotalFlag** is a boolean that specifies if the constant sum must total to a specific value. **mustTotalFlag** is a boolean that specifies if the constant sum must total to a specific value.
  
Line 62: Line 75:
 **prefix** is text that is shown before numeric values. **prefix** is text that is shown before numeric values.
  
-Default: ""+Default: %%""%%
 ==== suffix ==== ==== suffix ====
 **suffix** is text that is show after numeric values. **suffix** is text that is show after numeric values.
  
-Default: "%"+Default: %%"%"%%
 ==== widths ==== ==== widths ====
-**widths** is the width of the constant sum numbers in ems (an 'em' is a wide character).+**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 Default: 3
 +====== Qualtrics Wiki ======
 +[[start|Qualtrics Wiki]]
mfcssliders.1662391040.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki