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
  • 4177 views

Userlevel 6
Badge +52
Hello Everybody!!
We need to launch a survey for updating customers´ data, so we need to make them to select which of the 3 types of document do they have, and this is just one of the field from the form and we don´t want to make an additional question for this.

I want to put the dropdown list in the yellow field:
!

Thanks for helping me!!! 😎 😎 😘 😘
icon

Best answer by uhrxx005 26 September 2019, 16:24

View original

44 replies

Badge

This QSF file should help you set it up.

where can i find the QSF? 

Badge +1

This QSF file should help you set it up.

Can someone share the QSF file with me?

Badge

Thanks so much David!!! That´s exactly what I needed!!!
SUPER GENIUS!! 😎 😎
Greetings from Colombia - Vocé!

What am I missing? Where is this super genius solution - I’m not seeing it in this thread. You mind sharing with a nube.

 

Userlevel 7
Badge +27

@Joris_D  - I have a function, formSelects, that supports default choices. It is also much more flexible and robust that the code posted on this thread.  If interested, you can contact me by private message.

Userlevel 7
Badge +20

Hello @uhrxx005, would you please be able to re-upload this QSF as a zip file for all new users who view this post? 🙂

@matthewlegge @jtherien, it seems that this file has been removed. Let’s hope the user is willing and able to re-upload the file as a zip file for you to download.

Badge +1

QSF file seems to be gone.

Badge

This QSF file should help you set it up.

It’s possible I’m missing something because I’m new to the community side of Qualtrics, but where is the QSF file linked?  

Phew.  I thought it was me.  I couldn’t find it either.

Badge +2

This QSF file should help you set it up.

It’s possible I’m missing something because I’m new to the community side of Qualtrics, but where is the QSF file linked?  

Userlevel 7
Badge +33

Thanks.  So apparently it has to do with a static theme.  I need to create a dynamic theme.  So for now, I just switched it to a blank dynamic theme.  However, after I change the layout to something else (not simple), there is absolutely nothing different in order for me to make a more complicated matrix question.  *Sigh*  Thanks for all of the assistance today.  Just trying to make something more streamlined but making myself crazy in the process.  

I think you should reach out to Qualtrics account executive to know your license limit.

Badge

Thanks.  So apparently it has to do with a static theme.  I need to create a dynamic theme.  So for now, I just switched it to a blank dynamic theme.  However, after I change the layout to something else (not simple), there is absolutely nothing different in order for me to make a more complicated matrix question.  *Sigh*  Thanks for all of the assistance today.  Just trying to make something more streamlined but making myself crazy in the process.  

Userlevel 7
Badge +33

Thanks.  Unfortunately my layout option is grayed out so I assume we don’t have a full software license.  

You should check with your brand administrator. I think you might not have permission to change it. If it will be grayed out for them then for sure this issue is about the license agreement. 

Badge

Thanks.  Unfortunately my layout option is grayed out so I assume we don’t have a full software license.  

Userlevel 7
Badge +33

@jtherien , here you go. Do not select simple layout.

 

Badge

@jtherien , you can use side by side setup. but make survey side by side setup doesn’t support simple layout. You will need to change your survey layout from look and feel for this setup.

Can you give me some instruction?  I’m wondering if my institution doesn’t have a full license because I can’t see anything in Look and Feel to make these changes.

Userlevel 7
Badge +33

@jtherien , you can use side by side setup. but make survey side by side setup doesn’t support simple layout. You will need to change your survey layout from look and feel for this setup.

Badge

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

How do I make a question formatted like this?  I cannot figure it out for the life of me.  Thanks!

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/50630#Comment_50630Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .InputText").css("border","none");
});

Userlevel 4
Badge +10

Very nice @TomG! Are you aware of any code out there to remove the border around form fields? If a field is editable it makes sense to have a border, but if I'm using JS coding to prevent editing it would be nice to have the border hidden / removed to the respondent doesn't misinterpret.

Userlevel 7
Badge +27

If anyone is interested in a form dropdown solution that is much easier to implement and has much more functionality, see formSelects.

Userlevel 1
Badge

This code works beautifully!
I am wondering if it is possible to combine this with some code for a default choice based on an embedded data field?
For example, the code below works for a a standard drop-down question:
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Adds default to dropdown question choice based on embedded field*/
var select = jQuery("#"+this.questionId+" select");
if("${e://Field/track}" == "Alt 1") select.val("1");
if("${e://Field/track}" == "Alt 2") select.val("2");
if("${e://Field/track}" == "Alt 3") select.val("3");
if("${e://Field/track}" == "Alt 4") select.val("4");
if("${e://Field/track}" == "Alt 5") select.val("5");

});

Would there be a way to combine it with the code to add a dropdown to a form question? (I am adding the code shared in this thread below for convenience so people don't have to download and import the qsf file)
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Creates dropdown lists for form text entry boxes*/
var that=this.questionId;
var element="";
  jQuery(element).insertAfter("#"+that+" .InputText:eq(2)");

  jQuery("#"+that+" .InputText:eq(2)").hide();
  jQuery("#"+that+" .InputText:eq(2)").val(jQuery("#s1 option:selected").text());

  jQuery("#s1").on('change',function(){
  jQuery("#"+that+" .InputText:eq(2)").val(jQuery("#s1 option:selected").text());
  });

});

Any help is much appreciated!

Userlevel 1
Badge +6

Got it figured out....Looks like I needed to change the variable names s1, s2, s3, etc. and just continue the numbering of each one on each question.

Userlevel 1
Badge +6

I created a form field that is using javascript from the community link below. It is working great when I tested it on the original question (meaning the options show up and I can select the right ones). I am re-using this question multiple times in the survey and so I just duplicated the question (which also worked great to display the response).
When I checked the response data I noticed that the additional questions are displaying what was recorded in the 1st question and not in the subsequent responses. (i.e. I select age of child 1 (1st question)=10, 2nd child (2nd question)=15. The fields generate the correct answers in the survey, but the response data in Data & Analysis only shows age=10 for both child 1 & 2.
These are all listed on the same page and expand from child 1 up to child 10 (depending on how many children the person selected in previous question)
I assume there is something I need to change for each question so that the response data, piped text, and future embedded data knows what was in the field of each question and doesn't reference the 1st response choices. I'm still a pretty new person to javascript, so any guidance would be appreciated. Thanks.

Badge +1

OK Thanks.

Userlevel 5
Badge +11

Sounds like Javascript needs to be enabled for your account or in the survey or something. You might have to reach out to Qualtrics support for that. It will be a setting in the user type no doubt but it might also depend on you level of account.

Badge +1

Rod_Pestell I get the following error - You do not have permission to use JavaScript in the survey editor.
Can you help me with this.
Thanks

Leave a Reply