Auto-checked Yes/No with condition. | XM Community
Solved

Auto-checked Yes/No with condition.

  • 26 March 2021
  • 3 replies
  • 22 views

Hello all
I am creating a survey consists of 10 questions, and I would like to add a questions right at the end with Auto-check boxes of Yes/No when a certain conditions are met.
If the user answered all questions, the Yes box is autochecked, and if user missed any question, then the NO box is autochecked.
Is this possible?

Thanks

Shuang.

icon

Best answer by ElieD 14 April 2021, 15:39

View original

3 replies

Userlevel 5
Badge +15

Someone may be able to offer code that you could use to do this, but it's not currently built into the platform: https://www.qualtrics.com/community/discussion/7914/allow-for-logic-in-piped-responses-for-default-choices

Userlevel 6
Badge +37

Hi Shuang,

Here is a working code :

First, add an embedded with your conditions to verify survey completion :
The value of the embedded data have to correspond with your yes/no question options

In my example, the validation question choices are 1 for "Yes" and 2 for "No"
image.png
So my embedded data will be set like that
image.png
Once you have your embedded data set, you can add this javascript code to your question
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});


Qualtrics.SurveyEngine.addOnReady(function()
{
var complete = "${e://Field/complete}";
this.setChoiceValue(complete, true)
});


Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});

Et voilà !

Thank you!

Leave a Reply