Alphabetize Answer Choices When Inserting New Answer Choice | XM Community
Question

Alphabetize Answer Choices When Inserting New Answer Choice

  • 23 January 2020
  • 6 replies
  • 401 views

Hi! I created a survey with a question that asks the respondent to select the name of their class. It is a multiple choice question with a dropdown list of answer choices. I created the initial batch of answer choices by typing the class names into Word, alphabetizing them, and pasting them into the dropdown.

We frequently need to add new class names to the answer choices. However, I have not been able to find a way to insert a new class name in the correct alphabetized spot among the existing answer choices. The only option I've found is to add the class name as a new answer choice, which is added to the bottom, and then manually click an arrow to move it to the correct spot within the answer choices.

I've spoken to the Qualtrics help line and the rep didn't know of a way to insert an answer choice anywhere but at the bottom of the list. In Survey Monkey, you can click a + sign to insert the answer choice in a particular spot, and there is also an option to display all answer choices alphabetically.

Is there a way for me to insert new answer choices and easily maintain the alphabetical order? Or a way to display the answer choices alphabetically, even if new answer choices are added?

6 replies

Userlevel 7
Badge +22
We can alphabetize the list at run time using javascript
> @rondev said:
> We can alphabetize the list at run time using javascript

Hi Rondev! That sounds like it's exactly what I'm looking for. I searched the internet a couple days ago for the script and wasn't able to come up with anything. Do you happen to have the javascript code that would do that?

MeganS Hi MeganS, did you get the JavaScript to alphabetize the list by Rondev? rondev would you mind to share your JavaScript to alphabetize the list with me, too?
Thanks a lot for your help in advance.

VeraEE No, I never received it. rondev can you please post the JavaScript code?
Thank you!

rondev - Can you please post the JavaScript code?

Userlevel 7
Badge +27

I anyone is interested, I have a non-free JS function that alphabetizes choices on-the-fly. It works with vertical single answer, vertical multi-answer, dropdown list, select box, and multi-select box multiple choice questions. It supports translations (i.e., collates based on the current survey language), and anchoring designated choices to the bottom of the list. It does not support choice groups.
If interested, contact me by private message.

Leave a Reply