Do NOT auto-check boxes if text entry is used | XM Community
Skip to main content

I have a multiple choice question that allows multiple answers and has text entry that forces responses on some of the selections. Currently, if a respondent enters anything into the text entry box of an answer choice, that answer choice gets automatically checked. I do NOT want the answer choice to be auto-checked (i.e. if the respondent enters text into a text entry box, the selection remains unchecked unless the respondent checks it).

Is there a way to turn the auto-checking off?

 

This post contains AI generated content that may not be entirely accurate. Contact ​@AlonsoC for further details

Hi ​@theresa890!
By default, Qualtrics automatically checks a choice if the respondent types anything into the associated text entry box. Unfortunately, there’s no setting to disable that behavior via the UI. But you can override it using a bit of JavaScript.

Qualtrics.SurveyEngine.addOnload(function () {
const questionContainer = this.getQuestionContainer();
const checkboxes = questionContainer.querySelectorAll('input(type="checkbox"]');
const textboxes = questionContainer.querySelectorAll('input(type="text"]');

textboxes.forEach((textbox, i) => {
textbox.addEventListener('input', () => {
// Only uncheck if it was auto-checked (not manually toggled)
if (!checkboxesci].dataset.userClicked) {
checkboxesci].checked = false;
}
});
});

checkboxes.forEach((checkbox) => {
checkbox.addEventListener('click', () => {
checkbox.dataset.userClicked = true;
});
});
});

 

Make sure to place this code in the question’s JavaScript editor (click on the gear icon > Add JavaScript), and match this script to your specific question layout if you’ve customized it.

Let me know if it helps.
-- Rochak


@rochak_khandelwal thanks for your response! Unfortunately, I added that code but the check box still “auto-checked” when I typed something into the text entry box. I haven’t change the layout of the question at all, and I added the code underneath Qualtrics.SurveyEngine.addOnload(function() in the Javascript editor.


@theresa890 , I am sorry it’s not working. Qualtrics forces auto-check behavior when a textEntry field is filled.
A work-around could be to use Standalone Text Entry Boxes, if that’s okay with your design.


That’s alright, I appreciate your response! I made a workaround using a side-by-side question that has a column for text entry and a column for a checkbox.