Form field display logic | XM Community
Skip to main content

Form field display logic

  • November 3, 2022
  • 3 replies
  • 290 views

Forum|alt.badge.img+1

I have a text form question with 3 fields as seen in screenshot. I have added a display logic saying that option 2 be displayed when option 1 is not empty. Similarly, display option 3 when option 2 is not empty. But when I run the survey, it is asking for option 1 and then moving on to the next question.
image.png

3 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • 1555 replies
  • November 3, 2022

jashtheawesome
Option-based display logic do not have inpage display logic hence, your logic would not work.
As you can see here: it is greyed out.
image.pngYou need to write javascript to achieve the functionality.
Hope it helps!


Forum|alt.badge.img+1
  • Author
  • 2 replies
  • November 3, 2022

Hi Deepak,
First, thank you so much for your help. Yes, I saw that but was excited to see the display logic option. Is there any way you can help with the JS as I am not very good at it? If you can't then it is alright. :)
Cheers,
Sujan


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • 1555 replies
  • November 3, 2022

jashtheawesome
You can write something like below and change the QID appropriately. I have done for one step
Qualtrics.SurveyEngine.addOnReady(function()
{

jQuery('#QID13').find('tr')[1].hide();
/*Place your JavaScript here to run when the page is fully displayed*/
jQuery("#"+this.questionId+" .InputText").change(function() {
jQuery("#QID13").find('tr')[1].show();

});
});


Hope it helps!