Record text entry response on page submit | XM Community
Skip to main content
Question

Record text entry response on page submit

  • November 11, 2024
  • 2 replies
  • 47 views

Forum|alt.badge.img+6
  • Level 2 ●●
  • 19 replies

Hello,

 

I have a text entry (numeric) question that loops 4 times. I want to record the response of the 2nd loop as an embedded data field to be used in a later part of the survey. I am currently using the following code in js, but it is not working. Any thoughts on how to get the code to work?

 

Qualtrics.SurveyEngine.addOnPageSubmit(function() { 
    
    if("${lm://CurrentLoopNumber}" == 2) {
        var res_beliefdays = jQuery("#" + this.questionId + " .InputText").val();
         Qualtrics.SurveyEngine.setEmbeddedData("res_beliefdays",res_beliefdays);
    
    }

});

    

2 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • November 11, 2024

@pb7 Your code run fine with all Layout except Simple Layout! If you’re using Simple Layout, use the other one.


Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • 19 replies
  • November 11, 2024

Thanks @Nam Nguyen ! 

I am using the Classic layout.. it does not seem to be working on that either..

res_beliefdays is defined as a numeric variable in the survey flow. Should I use a parseInt somewhere?

thanks for your help!


Leave a Reply