Auto-fill/Auto-select option, when just one option is shown and move ahead in the survey | XM Community
Skip to main content
Question

Auto-fill/Auto-select option, when just one option is shown and move ahead in the survey

  • March 4, 2020
  • 5 replies
  • 352 views

How to auto select an option when the respondent is only shown one option and have him move ahead in the survey, without showing that particular question.

5 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • March 24, 2020
Instead of custom code, Add display logic to that question such that - show if two or more option visible. Now in survey flow add an embedded data that will store the response of this question if that was displayed else store the one option that was displayed

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • March 24, 2020
@Shruti, If it is a multiple choice question, you can use the following. It has the advantage of the question being answered in the response data. https://gist.github.com/marketinview/8310ba82acde38be62f007095bbe0278

Forum|alt.badge.img+1
  • September 14, 2022

The code TomG shared worked perfectly for me!
Some advice for those who don't know javascript, like myself:
Change the 'true' in this line to match whatever saved answer you're looking for.
qobj.setChoiceValue(displayedChoices[0], true)
I had a constant sum question for my follow-up question, so I changed it to this:
qobj.setChoiceValue(displayedChoices[0], 100)


MattiasM
Level 5 ●●●●●
Forum|alt.badge.img+63
  • Level 5 ●●●●●
  • February 2, 2023

https://community.qualtrics.com/XMcommunity/discussion/comment/23423#Comment_23423Thanks TomG - Solved it for me as well. Almost two years later! :)


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • February 2, 2023

If anyone is interested I have a more advanced function called skipFollowUp that serves the same purpose, but it works with multiple question types (MC, constant sum, constant sum slider, rank order, and PGR with one group), handles hiding the question so it doesn't flash on the screen, and addresses hiding the previous button on the next page.