The mcPointAllocation function enables points or cost to be assigned to each choice in a multiple choice question and calculates, displays and saves the total for the choices selected. It supports setting a maximum total and can be used to do a weighted allocation or build a product with specific features.
Features include:
Here is a quick video demonstration:
This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.
Add the mcPointAllocation 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 mcPointAllocation function JS:
<script>/*Paste mcPointAllocation function JS here*/</script>
Alternatively, paste the mcPointAllocation function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
The mcPointAllocation function uses two questions: the multiple choice question itself and a text entry question immediately following the multiple choice question to capture the total. The text entry question is not visible to the respondent.
Add the points or cost of each choice to the choice label inside a <span> with the class "pts". ONLY numbers should be inside the <span>. All other text, such as currency symbols, should be outside the <span>.
<span class="pts">5</span>
If there is a maximum point allocation or price, add custom validation to the multiple choice question to pass validation if the hidden text entry question is less than or equal to the maximum.
Add JS to call the mcPointAllocation function to apply it to the multiple choice question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
mcPointAllocation(this);
});
To override the default options, specify the desired options is the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
mcPointAllocation(this,{max:1000,prefix:"$"});
});
A single line text entry question with any question text. No requirements, validation or JavaScript is needed.
base is a numeric field containing a starting total before any choices are selected.
Default: 0
debug is a boolean that turns on display of the hidden total question when true.
Default: false
decimals is numeric field specifying the number of decimal places the total should have.
Default: 0
label is a string that specifies the text label of the total.
Default: "Total: "
labelStyle is a string that specifies CSS style of the <div> that contains the total label and total.
Default: "text-align:right;font-weight:bold;"
max is a numeric field containing the maximum total. When max=0 there is no maximum. When the total exceeds max, the total (including prefix and suffix) will be displayed in overMaxColor.
Default: 0
overMaxColor is a string that specifies the CSS color to be used for the total when the max is exceeded.
Default: "red"
prefix is a string that specifies the text to be shown after the label and before the total (e.g., $).
Default: ""
suffix is a string that specifies the text to be shown after the total (e.g., "€").
Default: ""