Skip to main content
Participant
October 1, 2015
Question

Common JS Interface - Captivate 8 (pulling content from an html file)

  • October 1, 2015
  • 1 reply
  • 399 views

I have hit a stop on the ComonJS interface (window.cpAPIInterface.setVariableValue), and what should be relatively simple, I'm having difficulties with. I can't get the name to render. This is what I have:

In my Captivate published HTML file, in the <head> section, I set the following variable "learner", and define the function setLearnerName() function as:

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title></title>

<script src="standard.js" type="text/javascript"></script><script>

<script>

  var learner = "MyName;

  function setLearnerName(){

     window.cpAPIInterface.setVariableValue("learner_name", learner);

}

</script>

</head>

In my Captivate file in the Script Window, I simply call the function: "setLearnerName();" and do nothing else.


Yet, when I run on my server the published version, the output is blank, and not "MyName".


Can anyone advise me on what to do to get the variable set in the HTML file to that of the Captivate Caption output? I used this article as a reference: Common JS interface


Thanks for your time.

Bibi

This topic has been closed for replies.

1 reply

TLCMediaDesign
Inspiring
October 2, 2015

You're missing a closing quote setting "learner":

var learner = "MyName";