is there a way to dynamically add more free text boxes in a matrix question | XM Community
Question

is there a way to dynamically add more free text boxes in a matrix question

  • 27 December 2023
  • 4 replies
  • 112 views

Badge +3

Hi, I am wondering if this is a feature of matrix questions with free text entry. Is there an option for survey respondents to dynamically add more free text entry rows in a matrix question, if for example there are 5 rows in the question, but the respondent has 6 unique entries? 


4 replies

Userlevel 6
Badge +27

We cannot have unlimited rows in matrix since we need to specify the max number while programming. Now using JS just show first three rows and hide others, add plus button to show new rows.

Badge +3

Thank you! that is helpful, is there code to get started with hiding other rows and an add plus button to show new rows? 

Userlevel 6
Badge +27

Thank you! that is helpful, is there code to get started with hiding other rows and an add plus button to show new rows? 

Try using the below code:

var that=this.questionId;
jQuery("#"+this.questionId+" tr.ChoiceRow:not(:eq(0))").hide();
jQuery("<input type='button' id='add' value='+' name='+' />").insertAfter("#"+this.questionId+" tr.ChoiceRow:last");
jQuery("#add").on('click',function(){
var c= jQuery("tr.ChoiceRow:visible").length;
jQuery("#"+that+" tr.ChoiceRow:eq("+c+")").show();
});

 

Badge +3

Thank you! Where would this code go? In the Question Text or the Question Option Response? 

Leave a Reply