Hello,
I’m trying to use JavaScript to calculate the sum of specific text entry fields from three earlier form questions (QID188, QID191, and QID194). I want to store that total in an Embedded Data field (DSNavigationReferral) so that I can compare it to a later response (QID423), which contains another set of text entry fields.
-
In QID188, QID191, and QID194, I want to add only the fourth text entry field from each question (e.g., QRQID1884, QRQID1914, QRQID1944).
-
I'm placing JavaScript on Q194 using
addOnPageSubmit()to calculate the sum and set the Embedded Data value. -
In Survey Flow, I’ve inserted
DSNavigationReferralas an Embedded Data field after the Q194 block and before the Q423 block. -
In Q423, I use JavaScript to compare the total entered there to the value stored in
DSNavigationReferral, and disable the Next button if they don’t match.
However, the value for DSNavigationReferral always appears to be null or 0 by the time Q423 loads. The comparison doesn’t work, and no warning is triggered.
Things I’ve tried:
-
Using
addOnPageSubmit()instead ofquestionclick() -
Checking input field names manually via export tags
-
Confirming that the Embedded Data is declared in Survey Flow before Q423
Could you please help me determine why the Embedded Data value is not being stored correctly, or suggest a working approach for this use case?
Thank you!
