Text box questions disable/enable | XM Community
Skip to main content
Solved

Text box questions disable/enable

  • April 12, 2018
  • 5 replies
  • 288 views

Hello, I have a question type like below. Multiple choice type question with "Yes" or "No" options. After that have two text entry question. Like 1) if Yes, Why? 2)if No, Why? I want to text box questions, will disable by default with the help of jQuery/Java script. If option "Yes" sleeted at multiple choice question that particular text box question will get enable. Respectively for option "No". Could you please help me on this requirement?

Best answer by bstrahin

Are you trying to say you want to display the follow-up question when your condition from the multiple choice (yes/no) question is met? There's no need to jQuery/Java script for that. Use the built in question display logic (https://www.qualtrics.com/support/survey-platform/survey-module/question-options/display-logic/) You would still have three questions 1. yes/no, 2. why yes, 3. why no. You don't put any logic on question 1. For question 2 add question display logic where Q1 is yes. And for question 3 add display logic where Q1 is no. The link above will show you exactly how to interact with the interface to add question display logic.

5 replies

bstrahin
Level 6 ●●●●●●
Forum|alt.badge.img+38
  • Level 6 ●●●●●●
  • Answer
  • April 12, 2018
Are you trying to say you want to display the follow-up question when your condition from the multiple choice (yes/no) question is met? There's no need to jQuery/Java script for that. Use the built in question display logic (https://www.qualtrics.com/support/survey-platform/survey-module/question-options/display-logic/) You would still have three questions 1. yes/no, 2. why yes, 3. why no. You don't put any logic on question 1. For question 2 add question display logic where Q1 is yes. And for question 3 add display logic where Q1 is no. The link above will show you exactly how to interact with the interface to add question display logic.

  • Author
  • April 12, 2018
ok Thank you.

  • April 30, 2018
I have a related question which I think Display logic won't solve. I have two questions per page, and the participants can only answer one of them. I want them both be enabled in the beginning, but if they answer one, the other one becomes disabled. And if they cancel their answer in the first one, the other one becomes enabled again. Is there a way to do this? Thanks!

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • April 30, 2018
@TeLa - If you have a new question it is best to start a new discussion. The only way to do what you want is with JavaScript.

  • Author
  • May 8, 2018
Hi Tela, Here is the java script code for similar requirement, you can edit bit based on your requirement. Qualtrics.SurveyEngine.addOnload(function () { //disables the next button on the page //question click is a simple onclick handler //attached to the question's container div this.questionclick = function(event,element) { //by default you get the click event as the first parameter and the clicked element as the second parameter console.log(event, element); if (element.type == 'radio') { var choiceNum = element.id.split('~')[2]; alert('You clicked on choice '+choiceNum); if (choiceNum == 2) { //enables the next button - Note that the QuestionData object is bound to this to make it easier to use jQuery('.QR-' + this.questionId).removeAttr('disabled'); } else { //disables the next button jQuery('.QR-' + this.questionId).attr('disabled','disabled'); } } } });