Enable respondent to delete tex entry fields in a matrix | XM Community
Question

Enable respondent to delete tex entry fields in a matrix

  • 29 April 2020
  • 3 replies
  • 14 views

Hi! I recently came across a discussion about how to enable study participants to add text entry fields in a matrix. The solution provided by uhrxx005 worked perfectly. However, in the second part of our study we would like to present that list again and allow them to add new fields with arguments (which has worked with embedded data) but also allow participants to remove previous arguments.
For example: A participants might have provided 10 arguments in study 1. In study 2, the participant is shown their 10 arguments from study 1 and would now have the possibility to, say, remove arguments 2, 5 and 7.
We are aware that it would be possible to just remove the text in those fields and leave them blank. On the other hand, this might not be as intuitively understood by all participants.
Thank you very much in advance!


3 replies

Userlevel 7
Badge +22

We can first ask them multi select question (to choose which arguments to remove) with options as ED pipe text (which has value of previous study arguments). Now carry forward the un selected options from this question to next matrix question, which will also have more open ended statements other than carry forwarded un-selected options.

Thanks for your reply! I was hoping it would be possible to edit the code below (from the above mentioned thread) so that it might solve the problem in a more elegant manner. I'd rather not make it too complicated for the participants if at all possible.


ualtrics.SurveyEngine.addOnReady(function()
{
var that=this.questionId;
jQuery("#"+this.questionId+" tr.ChoiceRow:not(:lt(3))").hide();
jQuery("").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();
});

});

Userlevel 7
Badge +27

Hi there, if you still need, I was able to adapt that code so that a "-" button appears next to the "+" which will hide the last row upon click. For the Matrix Text Entry question, try adding the below JavaScript to the OnReady section:
var that=this.questionId;
jQuery("#"+this.questionId+" tr.ChoiceRow:not(:eq(0))").hide();

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

jQuery("").insertAfter("#add");
jQuery("#minus").on('click',function(){
        var d= jQuery("tr.ChoiceRow:visible").length;
        d -= 1;
        jQuery("#"+that+" tr.ChoiceRow:eq("+d+")").hide();
    });

Leave a Reply