Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

277
Visualizações
Using Javascript in Qualtrics to Embed Data from a Response Option

My goal is to randomize 10 items within a block, and then ask a series of questions about the last item displayed. I got JS to work for the item stem, but not for the response option that was selected.

I begin by defining the embedded data at the beginning of the survey.

enter image description here

Next, I add JS for each question in the first block. Labeling them with the same embedded name causes Qualtrics to overwrite the embedded data each time, which means that it will remember the last question displayed from the first block:

JS for Q1 (note that it calls QID1):

Qualtrics.SurveyEngine.addOnload(function()
{
    
    var text = "${q://QID1/QuestionText}";
    
    Qualtrics.SurveyEngine.setEmbeddedData( 'TestQuestion', text );
    
    var answer = "${q://QID1/ChoiceGroup/SelectedChoices}";
    
    Qualtrics.SurveyEngine.setEmbeddedData( "TestAnswer", answer );


});

JS for Q2 (note that it calls QID2):

Qualtrics.SurveyEngine.addOnload(function()
{
    
    var text = "${q://QID2/QuestionText}";
    
    Qualtrics.SurveyEngine.setEmbeddedData( 'TestQuestion', text );
    
    var answer = "${q://QID2/ChoiceGroup/SelectedChoices}";
    
    Qualtrics.SurveyEngine.setEmbeddedData( "TestAnswer", answer );


});

Next, I call the embedded data in the subsequent block in the questions:

enter image description here

However, when I launch the survey, it only displays the TestQuestion metadata:

enter image description here

What am I doing wrong? How can I get the response option (TestAnswer embedded data) to pipe in? Should it be added at a different spot in the JS?

I also tried this, but it didn't work:

Qualtrics.SurveyEngine.addOnPageSubmit(function(type)
{
    if(type == "next")
        
    {var answer = "${q://QID2/ChoiceGroup/SelectedChoices}";
    
    Qualtrics.SurveyEngine.setEmbeddedData( "TestAnswer", answer );}
    
});
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda