Hi
@rose_b
Please read this post it may help you to write code
https://www.qualtrics.com/community/discussion/926/side-by-side-question-constant-sum-and-auto-complete-dropdown
Hi
@rose_b!
It looks like you may be asking about custom programming/code. We actually have a
Developer Corner in the community that is reserved for these types of questions. Therefore, I have gone ahead and moved your question to that section so coders and programmers are more likely to answer your question.
P.S. They might assume that you already have a basic knowledge of programming and how to integrate it into Qualtrics. If you do not, we recommend checking out
W3Schools and our pages on
Adding Custom CSS and
Adding JavaScript to get a basic understanding!
Hello
@rose_b ,
The following code will work for Matrix table-> Test Entry, short (rows and column same as the image in the question)
Also in the validation type option of the question, select "content validation" -> "number"
Paste the following code in the js(onReady) of matrix question
for(var i=4;i<=8;i++){
jQuery(".ChoiceRow:eq(3) td.c"+i+" input").prop("disabled",true);
jQuery(".ChoiceRow:eq(5) td.c"+i+" input").prop("disabled",true);
}
this.questionclick = function(event,element){
jQuery(".ChoiceRow:eq(3) td.c4 input").val(parseInt(parseInt(jQuery(".ChoiceRow:eq(1) td.c4 input").val())+parseInt(jQuery(".ChoiceRow:eq(2) td.c4 input").val()))||0);
jQuery(".ChoiceRow:eq(5) td.c4 input").val((parseInt(jQuery(".ChoiceRow:eq(4) td.c4 input").val())/parseInt(jQuery(".ChoiceRow:eq(3) td.c4 input").val()))||0);
jQuery(".ChoiceRow:eq(3) td.c5 input").val(parseInt(parseInt(jQuery(".ChoiceRow:eq(1) td.c5 input").val())+parseInt(jQuery(".ChoiceRow:eq(2) td.c5 input").val()))||0);
jQuery(".ChoiceRow:eq(5) td.c5 input").val((parseInt(jQuery(".ChoiceRow:eq(4) td.c5 input").val())/parseInt(jQuery(".ChoiceRow:eq(3) td.c5 input").val()))||0);
jQuery(".ChoiceRow:eq(3) td.c6 input").val(parseInt(parseInt(jQuery(".ChoiceRow:eq(1) td.c6 input").val())+parseInt(jQuery(".ChoiceRow:eq(2) td.c6 input").val()))||0);
jQuery(".ChoiceRow:eq(5) td.c6 input").val((parseInt(jQuery(".ChoiceRow:eq(4) td.c6 input").val())/parseInt(jQuery(".ChoiceRow:eq(3) td.c6 input").val()))||0);
jQuery(".ChoiceRow:eq(3) td.c7 input").val(parseInt(parseInt(jQuery(".ChoiceRow:eq(1) td.c7 input").val())+parseInt(jQuery(".ChoiceRow:eq(2) td.c7 input").val()))||0);
jQuery(".ChoiceRow:eq(5) td.c7 input").val((parseInt(jQuery(".ChoiceRow:eq(4) td.c7 input").val())/parseInt(jQuery(".ChoiceRow:eq(3) td.c7 input").val()))||0);
jQuery(".ChoiceRow:eq(3) td.c8 input").val(parseInt(parseInt(jQuery(".ChoiceRow:eq(1) td.c8 input").val())+parseInt(jQuery(".ChoiceRow:eq(2) td.c8 input").val()))||0);
jQuery(".ChoiceRow:eq(5) td.c8 input").val((parseInt(jQuery(".ChoiceRow:eq(4) td.c8 input").val())/parseInt(jQuery(".ChoiceRow:eq(3) td.c8 input").val()))||0);
};
Thanks everyone for your help! Thank you
@mattr51 - that did the job!