Select2 For Many Options | XM Community
Skip to main content

Hi,
I am looking to have responders answer the airport they go to using the Select2 feature. As they type, a list of pre-set airports will come up from which they can choose from.
There are many airports, and therefore, Select2 can slow down. I have therefore been looking into pagination and ajax commands, but I am so lost. I have reviewed many forums, including the ones below. Unfortunately, I am still having trouble implementing this.
https://www.qualtrics.com/community/discussion/4105/select2-implementation ,
https://www.qualtrics.com/community/discussion/4111/formatting-multi-selects-in-select2-code
https://www.qualtrics.com/community/discussion/3524/using-select2-to-create-an-auto-complete-multiple-select-box-question
https://select2.org/data-sources/ajax
Could I get some help or be pointed in the correct direction in how I may create a database of airport names, connect it to a select2 single-select input, and incorporate pagination?

Thank you in advance for your help.

AutoComplete Option.PNGThere is an "autocomplete" option available for "text-entry" question which we can leverage for providing suggestive (options) to the user.
I have attached a snippet for your easy reference


Hi thank you for your help. I was actually able to implement this feature using JS. This option is not available for me as a radio button. Unfortunately, I am not sure how to implement validation so that only the ones that are suggested are typed in. When I checked online help, much of the support here recommended Select2 boxes. What do you advise?


Could I get some help or be pointed in the correct direction in how I may create a database of airport names, connect it to a select2 single-select input, and incorporate pagination?

  1. Create your airport database table on your web server

  2. Write a web service script the outputs X (pagesize) airports starting at an offset (offset is a multiple of the page size) and matching a search term as 'results' in json format. The json should also include a 'pagination','more' flag.

  3. Add the ajax data source to your select2 options.


Leave a Reply