Copy link to clipboard
Copied
Hello,
I have been searching for a solution to this and cannot find one. I am creating a software training and have to load in some variables naturally. I needed some random numbers, so I decided I would initialize all of my variable in JavaScript. Having a programming background I passed a variable OD_SPH as a string from JavaScript to Captivate. Sampled below.
var OD_SPH = "-3.00";
window.cpAPIInterface.setVariableValue("OD_SPH", OD_SPH);
When I attempt to display in captivate it converts this to -3 on display when I need it to show the trailing zeros. I've confirmed that JavaScript is capturing this as a string, but it would seem that captivate is converting this to an integer. Does anyone have any ideas on how to get this to display properly?
Thank you in advance,
Jacob Strand
If this is HTML5 only, just use:
window.OD_SPH = "-3.00";
If you use the cpAPIInterface.setVariableValue, Captivate does run it through a function (cp.ho) to convert a string.
Copy link to clipboard
Copied
If this is HTML5 only, just use:
window.OD_SPH = "-3.00";
If you use the cpAPIInterface.setVariableValue, Captivate does run it through a function (cp.ho) to convert a string.