The autoAnswer function automatically answers follow-up questions with only choice or answer. The single choice or answer may be due to carryforward or display logic. It supports both 'New Experience' and all legacy layouts. It works with the following types of questions:
It includes support for:
Here is a demonstration of a typical implementation:
The following demonstrates the different question types and formats autoAnswer works with:
This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.
To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag. Go to Look & Feel → General → Header edit →
and paste the provided autoAnswer function JS:
<script>/*Paste autoAnswer function JS here*/</script>
Alternatively, paste the autoAnswer function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.
The autoAnswer question can be a Multiple Choice, Constant Sum (text entry or slider), Rank Order, Slider, Matrix (likert, bipolar or constant sum), or Pick/Group/Rank question.
To prevent the auto answer question from flashing on the screen when automatically advancing to the next page (see next), add the following html to the question text:
<style>#survey-canvas, .Skin { opacity:0; }</style>
Then, add the following to the last question in the survey that is displayed to all respondents so that View Response displays properly in the Data & Analysis tab.
<style>#survey-canvas, .Skin { opacity:1; }</style>
Add JS to call the autoAnswer function to apply it to the follow-up question as follows:
Qualtrics.SurveyEngine.addOnload(function() {
autoAnswer(this);
});
To override the default options, specify the desired options in the second function argument as an object. For example:
Qualtrics.SurveyEngine.addOnload(function() {
autoAnswer(this, {next:false});
});
To support the Previous Button, add this JS to the question that immediately follows the follow-up question:
Qualtrics.SurveyEngine.addOnReady(function() {
if("${e://Field/__js_noPrevFlag}"=="1") this.hidePreviousButton();
});
Where the embedded data field name matches the name of the noPrevFlag option in the autoAnswer function call with __js_ added as a prefix.
next boolean that specifies if the survey should advance to the next page.
Default: true
noPrevFlag is that name of the embedded variable that will be used to hide or show the Previous Button on the next page following the autoAnswer question. Applicable when next is true.
Default: "" (empty)
value specifies the value for constant sum, slider, or matrix constant sum questions.
Default: "100"