is there a way to dynamically add more free text boxes in a matrix question | Experience Community
Skip to main content
Question

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

  • Dec 27, 2023 8:42 PM UTC
  • 4 replies
  • 379 views

Forum|alt.badge.img+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

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Dec 29, 2023 7:05 AM UTC

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.


Forum|alt.badge.img+3
  • Author
  • Level 3 ●●●
  • Dec 31, 2023 2:29 AM UTC

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


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Dec 31, 2023 6:16 AM UTC

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();
});

 


Forum|alt.badge.img+3
  • Author
  • Level 3 ●●●
  • Jan 2, 2024 5:58 PM UTC

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