Background: I took the info I found here: https://community.qualtrics.com/custom-code-12/is-it-possible-to-change-the-next-button-to-finish-based-on-embedded-data-18014?postid=41891#post41891 …
I have essentially two versions of a survey:
- Version 1: ends at Question 10 if ${e://Field/Acquisition} is blank
- Version 2: continues with Questions 11-20 if ${e://Field/Acquisition} is Yes
On Question 10, I added this JavaScript:
Qualtrics.SurveyEngine.addOnReady(function() {
if("${e://Field/Acquisition}" != "null"){
var newName = 'Submit'; //Update - New Next Button label
var lastLoopOnly = true; //Last loop only? Value doesn't matter to non-loops
//No changes below
if(!lastLoopOnly || "${lm://CurrentLoopNumber}" == "${lm://TotalLoops}") {
var nb = jQuery('#NextButton');
nb.val(newName);
nb.attr('title', newName);
}
}
});
I added this JavaScript because Version 1 should have a “Submit” button on the page showing Question 10 whereas Version 2 should have a “Next” button.
Problem: Version 1 is showing “Submit” which is great -- but Version 2 is showing “Submit” too and it should show “Next”.
What am I doing wrong?