Hi there, I am pretty new to Qualtrics and very beginner with JavaScript. I have been working on this problem for over 10 hours over the past week, and think it's time to ask for help.
I have a matrix table question with constant sum columns. The columns represent the days of the week. The rows represent different languages spoken by parents to their children. The values entered in are the number of hours spoken to the child in each language. In the vast majority of cases, the split of hours that applies on Monday also applies to all weekdays, and I'm trying to implement a button that, when clicked, copies the Mon column values to Tues, Wed, Thurs and Fri, to save time from entering a whole bunch of the same values. In my example, that would be 7 copied across the first row, and 2 copied across the second row.Using code from other questions I've seen, I've been able to add a button to my question, and when I click it, I can have an alert pop up, so I know the button itself works. However, I cannot for the life of me get the values to copy over. The code below is what I have currently and is set in the OnReady section of the Javascript.
Thank you very much for any guidance you can provide!
jQuery("#button").click(function() {
alert("does this button work?"); //This part is working
var l1mon = this.getChoiceValue(1,1); //The rest doesn't work
var l2mon = this.getChoiceValue(2,1);
var l3mon = this.getChoiceValue(3,1);
var l4mon = this.getChoiceValue(4,1);
this.setChoiceValue(1,2,l1mon);
this.setChoiceValue(2,2,l2mon);
this.setChoiceValue(3,2,l3mon);
this.setChoiceValue(4,2,l4mon);
this.setChoiceValue(1,3,l1mon);
this.setChoiceValue(2,3,l2mon);
this.setChoiceValue(3,3,l3mon);
this.setChoiceValue(4,3,l4mon);
this.setChoiceValue(1,4,l1mon);
this.setChoiceValue(2,4,l2mon);
this.setChoiceValue(3,4,l3mon);
this.setChoiceValue(4,4,l4mon);
this.setChoiceValue(1,5,l1mon);
this.setChoiceValue(2,5,l2mon);
this.setChoiceValue(3,5,l3mon);
this.setChoiceValue(4,5,l4mon);
});
});
Button that copies text entry values from column 1 of matrix table to other columns
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.