Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


ddalphabetize

ddAlphabetize - Alphabetize drill-down selects (aka dropdowns) on-the-fly in any language

The ddAlphabetize function arranges choices within drill-down selects (aka dropdowns) into alphabetical order on-the-fly. It is useful for translated surveys where you want the choices in alphabetical order for every language.

Functionality includes:

  • Alphabetizes based on current language
  • Supports anchoring of choices to the bottom of the lists

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

To alphabetize choices in multiple choice questions on-the-fly, see mcAlphabetize. To alphabetize choices in side-by-side selects on-the-fly, see sbsSelectAlphabetize.

Set-up Instructions

Survey Header

To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag: Add the ddAlphabetize 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 ddAlphabetize function JS:

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

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

Question JavaScript

Add JS to call the ddAlphabetize function to apply it to the Drill-down question as follows:

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

For anchored choices, use the anchors option to specify the choice ids (i.e., option values) as an array in the order the choices should be listed. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	ddAlphabetize(this,{anchors:[7,8]});
});

Options

anchors

anchors specifies the array of choice ids that should be anchored to the bottom of the lists. Choice ids should be listed in the order they should be displayed.

To identify choice ids (i.e., option values), preview the question and use the Inspect feature of your browser.

Default: [] (nothing anchored)

langs

langs is an object for mapping Qualtrics language codes to valid JavaScript locale languages for correct sorting. It is only needed if the Qualtrics language code doesn't resolve to a valid JavaScript locale language code. Of the built-in Qualtrics languages, only ZH-S (Simplified Chinese) and ZH-T (Traditional Chinese) don't resolve, but they are included in the langs object by default.

If you have created your own language code, you made need to add your language to the langs object if it doesn't automatically resolve. A new language specification would look like langs:{"XX":"yy"}.

qlang

qlang is the Qualtrics language code string that should be used to do the alphabetization. By default, this is the current language of the survey.

Default: "${e://Field/Q_Langauge}"

Qualtrics Wiki

ddalphabetize.txt · Last modified: 2023/09/25 07:14 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki