Table of Contents

sliderNumFormat - Format slider scale and value numbers

The sliderNumFormat function formats scale numbers (above the sliders) and values (appear when you drag a slider). It allows scale and value formats to be the same or different. The function uses Intl.NumberFormat() to format numbers in a variety of styles based on locale or locales. Some of the possibilities include:

Here is a simple example:

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Add Function To Survey

Add the sliderNumFormat 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 sliderNumFormat function JS:

<script>/*Paste sliderNumFormat function JS here*/</script>

Alternatively, paste the sliderNumFormat function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

JavaScript Function Call

Add JS to call the sliderNumFormat function to apply it to the Slider question as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	sliderNumFormat(this);
});

To override the default options, specify the desired options in the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	sliderNumFormat(this,{format:{style:"currency",currency:"USD",maximumFractionDigits:0}});
});

Options

format

format is a object used to specify the Intl.NumberFormat() formatting options. Options are specified the same way as in the Intl.NumberFormat() options object. format applies to both scale and value numbers.

Default: {} (empty, use Intl.NumberFormat() option defaults)

locale

locale is a string or array that specifies the locale or locales to be used by Intl.NumberFormat().

Default: "en-US"

valueFormat

valueFormat is an object that specifies the Intl.NumberFormat() formatting options for value numbers. Options are specified the same way as in the Intl.NumberFormat() options object. If the same option is included in the format option the valueFormat option takes precedence.

Default: {}

scaleFormat

scaleFormat is an object that specifies the Intl.NumberFormat() formatting options for scale numbers. Options are specified the same way as in the Intl.NumberFormat() options object. If the same option is included in the format option the scaleFormat option takes precedence.

Default: {}

Qualtrics Wiki

Qualtrics Wiki