I have a constant sum question, and the total should add up to 100 when respondents fill it out. I could set the validation to "must total" to force the response total to be 100, but in order to maximise participant survey completion rates, I don't want to force responses in my survey. Is there a way to generate some sort of a "request response" message if respondents click submit after incorrectly filling out the question (the total doesn't add up to 100)? I'm thinking of a message that appears once and gives respondents the option to return to the question to fill it out correctly, but also the option to just proceed to the next question.
Page 1 / 1
Qualtrics don't provide "Request response" feature with this type of question but you can achieve it using javascript. Please see below, this is how we can achieve it:
Qualtrics.SurveyEngine.addOnReady(function()
{
var warnings = [];
var count=0;
function init() {
jQuery('#NextButton').hide();
createNextButton();
}
function createNextButton() {
var nextButtonHTML = '<input id="CustomNextButton" class="NextButton Button" title="→" type="button" name="NextButton" value="→" aria-label="Next">';
jQuery('#Buttons').append(nextButtonHTML);
addNextButtonFunctionality();
}
function addNextButtonFunctionality() {
jQuery('#CustomNextButton').on('click', function() {
var responseTextField = document.getElementById('QID2~1_Total')
var currentResponse = responseTextField.value
if (currentResponse=="100" || count>0) {
jQuery('#NextButton').click();
} else {
alert("Please review your answers again");
count=count+1;
}
});
}
init();
});
Qualtrics.SurveyEngine.addOnReady(function()
{
var warnings = [];
var count=0;
function init() {
jQuery('#NextButton').hide();
createNextButton();
}
function createNextButton() {
var nextButtonHTML = '<input id="CustomNextButton" class="NextButton Button" title="→" type="button" name="NextButton" value="→" aria-label="Next">';
jQuery('#Buttons').append(nextButtonHTML);
addNextButtonFunctionality();
}
function addNextButtonFunctionality() {
jQuery('#CustomNextButton').on('click', function() {
var responseTextField = document.getElementById('QID2~1_Total')
var currentResponse = responseTextField.value
if (currentResponse=="100" || count>0) {
jQuery('#NextButton').click();
} else {
alert("Please review your answers again");
count=count+1;
}
});
}
init();
});
Thanks @KimothiSaurabh, this works perfectly!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.