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

Call an external javascript variable into captivate

Participant ,
Oct 05, 2016 Oct 05, 2016

I need captivate to reference an external JavaScript variable to check if its value is 1 or 0. If the value is "1" I need to display a button, if its "0" the button will be hidden.

The reason I need it external is I would like the customer to be able to change the variable value without having to republish the files.

 

I know if I add a folder and JavaScript file to "Program Files\Adobe\Adobe Captivate 9 x64\HTML\assets" it will always be published every time captivate publishes, the question is how do i get Captivate to reference the variable in this JavaScript file?

 

I'm using the latest version of Captivate 9.0.2, publishing to HTML5

Thanks

Gary

1.3K
Translate
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

correct answers 1 Correct answer

Participant , Oct 06, 2016 Oct 06, 2016

Thanks for your suggestions Peter!

I managed to get it working last night using a different method.

First I setup the variable "SP_Assess_Included" in Captivate with a default value of 0.

I then went into the "C:\Program Files\Adobe\Adobe Captivate 9 x64\HTML" folder and modified "index.html"

Then I added the following line in the <script> tag: var SP_Assess_Included = 1;

saved the file and republished the course.

i can now open the index.html or index_scorm.html in my published course folder and my

...
Translate
Contributor ,
Oct 05, 2016 Oct 05, 2016

Hi Gary,

  I am new to Captivate JavaScript as well. I think you would use the window.cpAPIInterface.setVariableValue to set the Captivate variable to the value of the java script variable. Similar to the example code below:

window.cpAPIInterface.setVariableValue("s1tb1",this.name);

where s1tb1 is my captivate variable name and name is my java script variable name.

Peter

Translate
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
Participant ,
Oct 06, 2016 Oct 06, 2016
LATEST

Thanks for your suggestions Peter!

I managed to get it working last night using a different method.

First I setup the variable "SP_Assess_Included" in Captivate with a default value of 0.

I then went into the "C:\Program Files\Adobe\Adobe Captivate 9 x64\HTML" folder and modified "index.html"

Then I added the following line in the <script> tag: var SP_Assess_Included = 1;

saved the file and republished the course.

i can now open the index.html or index_scorm.html in my published course folder and my new default variable is there and i can change its value as required and my course reads/updates it correctly on refresh/reload.

Gary

Translate
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
Resources
Help resources