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

Multiple choice with text entry allows multiple responses


Forum|alt.badge.img+1

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? 

 

 

3 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 9, 2023

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


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • May 9, 2023

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

 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • May 9, 2023

@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