New Survey Taking Experience is Breaking my JavaScript | XM Community
Skip to main content
Question

New Survey Taking Experience is Breaking my JavaScript

  • October 2, 2025
  • 7 replies
  • 144 views

Forum|alt.badge.img+3

Hi all,

I like the new look/feel of the New Survey Taking Experience but it’s broken my JavaScript.

I have two pieces of JavaScript: 

  1. To hide a question
  2. To autofill embedded data fields

Can you help?

=====================================

To Hide:

Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId).prev('.Separator').hide(); jQuery("#"+this.questionId).hide();
});

=====================================

To Autofill embedded data fields:

Qualtrics.SurveyEngine.addOnload(function()
{
Qualtrics.SurveyEngine.setEmbeddedData( 'caption1', "Tree" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption2', "Sand" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption3', "Monkey" );
Qualtrics.SurveyEngine.setEmbeddedData( 'caption4', "Oxygen" );
});

7 replies

Forum|alt.badge.img+3
  • Level 2 ●●
  • October 2, 2025

Hi There,

We use this javascript to hide:

Qualtrics.SurveyEngine.addOnload(function()
{
var questionIdToHide = this.questionId;
jQuery("#" + questionIdToHide).css('display', 'none');
});

And this still works to autofill:

Qualtrics.SurveyEngine.addOnReady(function () {
Qualtrics.SurveyEngine.setEmbeddedData('Filter1', 'abcd');
});

Regards,

Romano


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • October 2, 2025

Hi There,

We use this javascript to hide:

Qualtrics.SurveyEngine.addOnload(function()
{
var questionIdToHide = this.questionId;
jQuery("#" + questionIdToHide).css('display', 'none');
});

And this still works to autofill:

Qualtrics.SurveyEngine.addOnReady(function () {
Qualtrics.SurveyEngine.setEmbeddedData('Filter1', 'abcd');
});

Regards,

Romano

This works in the “New Survey Taking Experience”? I can’t get it to work :(


Forum|alt.badge.img+3
  • Level 2 ●●
  • October 2, 2025

@TerryFoster, I see.

Add this javascript within a question.
 

Qualtrics.SurveyEngine.addOnload(function()
{
const el = this.getQuestionContainer();
if (el) el.style.display = 'none';
});
Qualtrics.SurveyEngine.addOnReady(function () {
this.setEmbeddedData('Filter1', 'abcd');
});

 


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • October 2, 2025

@TerryFoster, I see.

Add this javascript within a question.
 

Qualtrics.SurveyEngine.addOnload(function()
{
const el = this.getQuestionContainer();
if (el) el.style.display = 'none';
});
Qualtrics.SurveyEngine.addOnReady(function () {
this.setEmbeddedData('Filter1', 'abcd');
});

 

JavaScript to hide works!! Still can’t get the embedded data to work though :(


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • October 3, 2025

Hi,

The setEmbeddedData() method is deprecated. You can still use it in old layouts, but not with the new survey taking experience.

You must use setJSEmbeddedData() and prepend your ED fields with __js_ in the survey flow.

See the Question API for more details.


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • October 5, 2025

Hi,

The setEmbeddedData() method is deprecated. You can still use it in old layouts, but not with the new survey taking experience.

You must use setJSEmbeddedData() and prepend your ED fields with __js_ in the survey flow.

See the Question API for more details.

I’ve done as instructed but it’s still not working. Can you double check my JavaScript?

=====

Qualtrics.SurveyEngine.addOnload(function ()  {
    setJSEmbeddedData("caption1", "Tree");
    setJSEmbeddedData("caption2", "Sand");
    setJSEmbeddedData("caption3", "Monkey");
    setJSEmbeddedData("caption4", "Oxygen");
})

=====

Embedded data fields are set as “__js_caption1” etc.

 


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • October 6, 2025

Hi,

Qualtrics.SurveyEngine.addOnload(function () {
Qualtrics.SurveyEngine.setJSEmbeddedData("caption1", "Tree");
});