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

IsabelPosada_Voce
IsabelPosada_Voce Medellin, ColombiaCommunity Member, XMPN Member, XMPN Champion, Qualtrics Brand Admin Guru ✭✭
edited July 29 in Custom Code

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!!! B)B):*:*

Best Answers

Answers

  • Johannes
    Johannes Community Member Qubie ✭

    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

  • Mrinalini
    Mrinalini New JerseyCommunity Member Qubie ✭

    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!

  • Mrinalini
    Mrinalini New JerseyCommunity Member Qubie ✭

    Never mind, figured it out! :)

  • NikhilAnand
    NikhilAnand Community Member Qubie ✭

    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?

  • dekennedy7
    dekennedy7 New York, NYCommunity Member, Qualtrics Brand Admin Guru ✭✭

    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.

  • KWigg
    KWigg SLC, UTCommunity Member, Qualtrics Brand Admin Qubie ✭

    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)

  • KWigg
    KWigg SLC, UTCommunity Member, Qualtrics Brand Admin Qubie ✭

    @dkennedy this is code I'm using; the highlighted portions are where the drop down options are declared.


  • KWigg
    KWigg SLC, UTCommunity Member, Qualtrics Brand Admin Qubie ✭

    @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.

  • Rod_Pestell
    Rod_Pestell Hemel HempsteadCommunity Member, Qualtrics Brand Admin Guru ✭✭

    Hi @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.

    I complete Field 3 using the drop down .

    The I click next

    You 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

  • uhrxx005
    uhrxx005 Community Member, XMPN Member, Qualtrics Brand Admin Guru ✭✭

    @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.

  • Rod_Pestell
    Rod_Pestell Hemel HempsteadCommunity Member, Qualtrics Brand Admin Guru ✭✭

    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

  • maveral
    maveral Lancaster, Lancashire, United KingdomCommunity Member Qubie ✭

    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.


Sign In to Comment

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!