Multiple choice with text entry allows multiple responses | XM Community
Skip to main content

Right now, I have a survey with a multiple choice question with text entry for each question (this is so the participants can elaborate). If the participant selects ‘No,’ writes text, and then selects ‘Yes,’ reenters text, their previous text from the ‘No’ question is still present. Is there a way to ensure that text is only allowed from the one question they select and it would delete the text if they selected another choice? 

 

 

One of the way without JS is to make this question multi select and mark each option as mutually exclusive.


If we want this functionality on single select then we can use below code:

var that = this;
jQuery("#"+that.questionId+" input[type='radio']").on('click change',function(){
jQuery("#"+that.questionId+" ul.ChoiceStructure li").not(jQuery(this).closest("li")).find(".InputText").val('');
});

 


@chb35 - You might be interested in the mcTextEntry function that clears text from deselected choices based on choice exclusivity. It also provides a bunch of other functionality for MC question with text entry. 


Leave a Reply