Multiple text entry with a 'click to add' option | XM Community
Question

Multiple text entry with a 'click to add' option

  • 3 April 2019
  • 2 replies
  • 221 views

Badge
Hi, I would like to make a question that enables people to create as many answers as they want in a separate answer box.
This is quite similar to this question (https://www.qualtrics.com/community/discussion/4136/1-question-multiple-text-entry-fields), but I don't want to limit the number of answer list beforehand.
Instead, I want to allow people to add an answer box below the previous answer by selecting 'click to add' option.

(Please do not recommend 'multi line' option. I need a separate answer list because I need to bring it back to evaluate the individual list in the last part of the survey!)

Thanks!

2 replies

Userlevel 6
Badge +11
Hi, @S_smith!

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, we recommend asking your question in that section instead 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!
Userlevel 7
Badge +27

Hi there, if you still need, this can be put in place for Form Field question or Matrix Text Entry by using JS to display text inputs when an 'add' button is clicked. I've also added some code that adds a 'minus' button which will hide text inputs when clicked.
For Form Field question, add the below to the question's JavaScript in the OnReady section
var that=this.questionId;
jQuery("#"+this.questionId+" tr:not(:eq(0))").hide();

jQuery("").insertAfter("#"+this.questionId+" tr:last");
jQuery("#add").on('click',function(){
        var c=jQuery("td.ControlContainer:visible").length;
        jQuery("#"+that+" tr:eq("+c+")").show(); 
    });

jQuery("").insertAfter("#"+this.questionId+" tr:last");
jQuery("#minus").on('click',function(){
        var d=jQuery("td.ControlContainer:visible").length;
        d -= 1;
        jQuery("#"+that+" tr:eq("+d+")").hide(); 
    });
For Matrix Text Entry question, add the below to the question's JavaScript in 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