Copy link to clipboard
Copied
I am using Captivate 9 and am wondering if anyone in the community would be able to help since I can't seem to find information on this anywhere. I am working on a project where kids will be able to enter their names. However, I would like to create a script that will prevent them from entering profanities.
I know how to do it using Advanced Actions, however, since the list is pretty long, it would take me an eternity to code that. I have tried using Javascript, but for some reason, Captivate doesn't seem to execute my script despite using code made available by Adobe : https://helpx.adobe.com/uk/captivate/using/common-js-interface.html
This is my code:
window.cpAPIInterface.getVariableValue(“F_NAME”);
if window.cpAPIInterface.getVariableValue(“F_NAME”=“butt”);
window.cpAPIInterface.setVariableValue(“Profanity”,“1”);
This is what I want it to do:
get the value of variable "F_NAME" and if that value is "butt", set the value of variable "Profanity" to "1"
thank you for any help! 😄
Copy link to clipboard
Copied
var fn = window.cpAPIInterface.getVariableValue(“F_NAME”).toLowerCase();
if ( fn === “butt”)
{
window.cpAPIInterface.setVariableValue(“Profanity”,“1”);
}