• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Create a Profanity Filter using Javascript

New Here ,
Dec 13, 2021 Dec 13, 2021

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! 😄

 

 

 

TOPICS
Advanced , Advanced actions

Views

58

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

LATEST

 

var fn = window.cpAPIInterface.getVariableValue(“F_NAME”).toLowerCase();

if ( fn === “butt”)
{
window.cpAPIInterface.setVariableValue(“Profanity”,“1”);
}

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines