Hello,
I have a matrix question with 3 statements (A, B, C) and 2 scale points (yes and no). I am trying to write a code such that B will show up when A is yes, and C will show up when B is yes. If no is chosen, respondents will be auto advanced to the next question.
All suggestions, and/or examples are very much appreciated!
Thanks in advance, and have a nice day!
Logic display and auto advance on a matrix question
Best answer by ahmedA
No, it's my fault for not looking into the nitty-gritties. This should do the job for you:
Qualtrics.SurveyEngine.addOnReady(function () {
all_rows = this.getQuestionContainer().querySelectorAll("tr");
that = this;
for (var i = 2; i < all_rows.length; i++) {
all_rows[i].hide();
}
this.questionclick = function (ev, el) {
var row = Number(el.id.split("~")[2]);
var choice = Number(el.id.split("~")[3]);
if (choice == 2 || row == all_rows.length - 1) {
that.clickNextButton();
} else if (choice == 1) {
all_rows[row + 1].show();
}
};
});
You can remove
|| row ==all_rows.length-1if you do not want to auto advance when a Yes on the third row is clicked.
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
