N/A checkbox with form or constant sum | XM Community
Skip to main content
Question

N/A checkbox with form or constant sum

  • October 31, 2024
  • 1 reply
  • 42 views

Forum|alt.badge.img+1

Hi all, 

I’m designing a survey where I need to add N/A checkbox option everywhere. For the most part, they are numerical text entries or form or constant sum type questions. I’m not sure how to code script for each one such that if its selected, the textbox empties or becomes inactive. 

I tried with a matrix but couldn’t get the validation right. 

 

Please help.

Thanks!

1 reply

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • 654 replies
  • November 2, 2024

For a matrix multi select question we can have below custom validation: 

And then use below script in the matrix multi select question:

jQuery("#"+this.questionId+" .InputText").on('input',function(){
if(jQuery(this).val()!='') jQuery(this).closest(".ChoiceRow").find("input:checkbox").prop("checked",false);
});
jQuery("#"+this.questionId+" input:checkbox").on('change',function(){
if(jQuery(this).prop("checked"))jQuery(this).closest(".ChoiceRow").find(".InputText").val('');
});