Hello, I have some JS code (posted below) on a question that isn't working properly. It worked fine but when I changed the theme (the old one is no longer available) it only partially works.
Basically I have a side-by-side matrix with two columns. The first has 4 options (A, B, C, D) and the second has two options (1, 2). My code prepopulates a value in the second column (1) if the first answer in the first column is chosen (A). If they try to choose the other option in column 2 (2), a pop-up tells them they can't choose that one.
The first part is working, where if they choose A in the first column, 1 in the second column is prepopulated but when I click 2 in the second column, although the pop-up appears, it no longer keeps 1 checked but allows me to change to 2. The code works in an old survey but not in any new ones I create. Any ideas?
if (element.type == 'radio')
{
var qNum = element.id.split('~')[1];
var rowNum = element.id.split('~')[2];
var cNum = element.id.split('~')[3];
var qbase = qNum.split('#',1);
var choiceNum1 = $('QR~'+qbase+'#1~'+rowNum+'~1').getValue();
var choiceNum2 = $('QR~'+qbase+'#2~'+rowNum+'~1').getValue();
if (qNum == qbase+'#1' && cNum == '1')
{ $('QR~'+qbase+'#2~'+rowNum+'~1').setValue(true);
}
if (qNum == qbase+'#2' && cNum != '1' && choiceNum1 != null)
{ alert('You can’t select this option);
$('QR~'+qbase+'#2~'+rowNum+'~1').setValue(true);
}
if (qNum == qbase+'#1' && cNum != '1' && choiceNum2 != null )
{ $('QR~'+qbase+'#2~'+rowNum+'~1').setValue(null);
}
JavaScript on Side-by-Side Matrix - Beginner Question
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.
