I am trying to make it so my next button is hidden until a certain requirement is met (all the dropdown questions, created using HTML, have an option selected -- if no option is selected, the value for each dropdown is “”).
With how it is right now, the next button is hidden, but selecting choices for each dropdown does not make the next button show up as needed. I’ve tried different iterations of this but can’t get it to make the next button show up.
Qualtrics.SurveyEngine.addOnload(function() {
//disable next button
this.hideNextButton();
var requiredLeftDropdownIDs = [
"dropdown1_left", "dropdown2_left",
"dropdown3_left", "dropdown4_left",
"dropdown5_left", "dropdown6_left",
"dropdown7_left", "dropdown8_left",
"dropdown9_left", "dropdown10_left",
"dropdown11_left", "dropdown12_left",
"dropdown13_left", "dropdown14_left",
"dropdown15_left",
];
allValid = true;
requiredLeftDropdownIDs.forEach(function (id) {
var dropdown = document.getElementById(id);
if (dropdown.value == "") {
allValid = false; // Mark as invalid if any dropdown is not properly selected
}
});
if (allValid) {
this.showNextButton();
} else {
this.hideNextButton();
}
});