How to get answer into embedded data while on the same page | XM Community
Skip to main content
Hi everyone I am trying to store the answers to two numeric questions with a Javascript into an EmbeddedData Field. I would like to do so on the same page as the question. Currently I save the data in an additional hidden question, but what do I have to add to my code so that it works without additional hidden question? Here is my code so far: ! Thanks a lot
Assuming your numeric questions are single text entry questions, add this script to each question (change the embedded variable): ``` Qualtrics.SurveyEngine.addOnPageSubmit(function() { var answer = jQuery("#"+this.questionId+" .InputText").val(); Qualtrics.SurveyEngine.setEmbeddedData("CQ1_participant_answer", answer); }); ```
Thanks for your answer! Works perfectly!