on the last page of my survey, I do some JS calculations (getting answer values, doing calculations and setting embedded fields). The code in the last question (which only exists so I can execute JS code there) doesn't work properly. It seems to only work when I access/load the last page/question multiple (2 or 3) times by using the table of contents element.
I suspect my issue is similar to this (order of execution): https://www.qualtrics.com/community/discussion/199/using-javascript-with-embedded-data-and-or-selected-choices
However, my code is executed on a (last) separate block, page and question, so I don't know why it's not working.
Also I added some console.log elements so that I can track the code and according to the chrome dev console, it seems that the code is being executed twice, with two different VM IDs (all my debug.log(whatever) are showing twice).
Why is it being executed twice there?
Why do I have to load the page/question multiple times to get my question to work?
How can I get my code to execute only once and then work properly?
Thanks for any help!
Best answer by CanerLC
View original