Javascript Not Executing unless Back button is pressed | XM Community
Skip to main content

Hi There - I am attempting to calculate the sum of three entries within a form field and display that sum on a later page. When I go to the next page, the embedded data value does not display. If I hit the back button, and then the next button again (not changing anything on the page), the JS executes and the ED value displays appropriately. My JS is below and is set to run on Unload - is there something I am missing to execute this when the next button is pressed?

var Hours1= parseInt("${q://QID2/ChoiceTextEntryValue/1}");
var Hours2= parseInt("${q://QID2/ChoiceTextEntryValue/2}");
var Hours3= parseInt("${q://QID2/ChoiceTextEntryValue/3}");

Total=Hours1+Hours2+Hours3

Qualtrics.SurveyEngine.addEmbeddedData( "Total",Total);



https://community.qualtrics.com/XMcommunity/discussion/23255/javascript-not-executing-unless-back-button-is-pressedYou don't need JS you can use Math Operations for this if there is just a numerical value in it. For your JS include it on the next page question Qualtrics doesn't register it until the page is loaded after next button is clicked.
Hope it helps!


Leave a Reply