NA boxes next to textboxes (text questions, form questions, constant sum questions, matrix questions) | XM Community
Skip to main content
Question

NA boxes next to textboxes (text questions, form questions, constant sum questions, matrix questions)

  • October 31, 2024
  • 3 replies
  • 68 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!

3 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • October 31, 2024

@Justeena You can make a side-by-side question like this

And put this code in

Qualtrics.SurveyEngine.addOnload(function() {
var rows = jQuery("tr.Choice");

rows.each(function() {
var row = jQuery(this);
var dontKnowRadio = row.find("input[type='radio'][value='1']");
var textBox = row.find("input[type='text']");

dontKnowRadio.change(function() {
if (dontKnowRadio.is(":checked")) {

textBox.val("").prop("disabled", true).css("opacity", "0.1");
} else {

textBox.prop("disabled", false).css("opacity", "1");
}
});
});
});

 


Forum|alt.badge.img+1
  • Author
  • October 31, 2024

That’s great! However - they can’t uncheck it once they select it. Does it make sense to be radio button? Is it possible to be a checkbox?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • October 31, 2024

That’s great! However - they can’t uncheck it once they select it. Does it make sense to be radio button? Is it possible to be a checkbox?

You can change the second question (column) into a multi-select.  Then change ‘radio’ to ‘checkbox’ in the script.