How can I put a drop-down list in a form question field? | XM Community
Solved

How can I put a drop-down list in a form question field?

  • 26 September 2019
  • 44 replies
  • 4321 views


Show first post

44 replies

Badge +1

Thank you Rod_Pestell

Userlevel 5
Badge +11

Hi desirazun ,
You create a new survey project and at the beginning you will be given the option to use use / upload a .qsf file. That then creates the survey with the question in which has hopefully what you need to get started.
Good luck
Thanks
Rod Pestell

Badge +1

I am newbie. I too want to create a formfield which has a dropdown list. I see that there is some code in this thread which seemed to have worked for everyone. My question - How do I open the QSF file and how do I use it?

Userlevel 2
Badge +3

Great thread, thank you all, specially uhrxx005
I was trying to put a list of countries in one of those drop-down menus, and I am trying to avoid the manual option of writing one by one as var element option1, option2, etc...
I found this nice piece of code online, but I can't make it work in the Qualtrics environment.
Any clue, please?
Thanks

Badge +1

Thank you for the thread! This was most informative.

Hi uhrxx005 , thanks a lot for your answer. It helped me a lot.
I'm also trying to prepare a question in a format similar to this. There is one text entry and two drop down lists for the dates. Do you have a code where I can put dates in drop down lists (from 1950 to 2021 and end year should be greater than start year)? I tried this solution but it didn't work for me. Thanks a lot.
1.jpg

Userlevel 5
Badge +11

Hi uhrxx005 , thanks for the reply. I'll reach out to someone in the forum then. Out of interest, was the source from another website, if so please could yo share that with me as it might be best to talk to the person you got the code from in the first place.
Thanks

Rod

Userlevel 6
Badge +5

Rod_Pestell , I initially got this code from someone else and I personally do not know how to program so I won't be able to help you with this. I would recommend posting the code in the Developer Corner and see if anyone there can help you modify it to accommodate the validation.

Userlevel 5
Badge +11

https://www.qualtrics.com/community/discussion/comment/18149#Comment_18149Hi uhrxx005 thanks very much for the file. I've discovered a problem however in that when you have a validation on the page (it can be another question or the same), when the validation message appears, the page is refreshed (perhaps redrawn) but the selection is then lost in the field that you have the drop down associated with.

This pic shows that in your example file I've placed a validation on Field 2.
image.png I complete Field 3 using the drop down .
image.pngThe I click next
image.pngYou can see that the entry in Field 3 has disappeared.
Hope you can help with a fix. I've tried to work out if it's possible to check if the original text box is populated already and if so select the entry in the drop down but my javascript is not good enough to figure that out and also I'm wondering if that might cause some sort of circular reference.

Hope you can help

Thanks

Rod Pestell

Badge +9

dkennedy sorry, misread your question. The .InputText:eq(1) indicates the SECOND item on the form to have the dropdown; likewise the (2) indicates the THIRD item on the form. Be sure to also indicate with the S1 and S2 you see throughout the code, as well.

Badge +9

https://www.qualtrics.com/community/discussion/comment/26473#Comment_26473dkennedy this is code I'm using; the highlighted portions are where the drop down options are declared.
image.png

Badge +9

I have a follow up on this - it seems that once the page containing the form/drop down question is submitted, the selection disappears. If using a back button, or even on a summary page at the end of the survey, these lines are blank. How do I keep them without using embedded data? (i.e. it needs to populate on the summary page)

Userlevel 4
Badge +10

Thanks for providing the QSF file uhrxx005. Super helpful. Quick follow-up question. What part of the code do you modify to change which response option has the dropdown menu? I'm not a coder and am having a little trouble identifying the change required.

Great solution! I adapted this code to fit a use case that uses a constant sum w/total.
I was wondering if there is a way to retain the user's choice after a validation error message is presented?
For ex: There are 2 boxes and a total field, the validation is set such that the total must be equal to a 100.
If box 1 equals 50, box 2 equals 10, the validation fails and the user's choices are reset to null. Is there a way to retain their choices if the validation fails?

Never mind, figured it out! :)

Hi, what do i do with the QSF file? Sorry, new to Qualtrics 🙂 I need to add a drop down list to a form question as well. please help!

Hey both,

just found this thread here, superhelpfull! So thanks also from my side 🙂 @uhrxx005: any chance you can also help me with this one? The width of the dropdown box is now smaller than the other ones. Do you know nhow i can adjust/ align the width of all answer boxes (incl. the drop-down) so that they're all the same widht (let's say 200 ptx :))?

Thanks,
Johannes
Userlevel 6
Badge +52
Thanks so much David!!! That´s exactly what I needed!!!
SUPER GENIUS!! 😎 😎
Greetings from Colombia - Vocé!
Userlevel 6
Badge +5
This QSF file should help you set it up.

Leave a Reply