Multiple Javascripts but no execution

Jul 01, 2016

Hi I Have at least 3 different scripts in my projects but  they don't seem to work.

I have attached my project below. but i have one attached to the start button to track and alert the user. Then one on the master slide to try and track the users pages. And finally one on contact to run various emails based on user select of their department found on the first page.

 

here are the codes:

 

Start button:

var CBTPlayer = GetPlayer();

var CBTData = new Object();

CBTData['CBTNameHere'] = CBTPlayer.GetVar("YourNameHere");
CBTData['CBTReference'] = CBTPlayer.GetVar('ReferenceNumber');
CBTData['CBTTrainingModuleID'] = CBTPlayer.GetVar('EEO CBT');
CBTData['CBTSlide Number Last on'] = CBTPlayer.GetVar('Slide No');

alert("Welcome " + CBTPlayer.GetVar("YourNameHere") );

 

 

Masterpage:

var player=GetPlayer();
var addr = window.location.search.substring(6);
player.SetVar("leap",addr);


Contact button: (in player)

Player = GetPlayer();
var sEmail = Player.GetVar("sEmail")

if (sEmail == "unknown"){
alert("Please choose a department.");
}else{
window.location.href = "mailto:" + sEmail;
}

 

6 Replies
Michael Hinze

I would test the script one by one, because if there is an error in one of the scripts none of them will work. Just by looking at the code, could the issue be the single quotes around the SL variable names in these lines:

CBTData['CBTReference'] = CBTPlayer.GetVar('ReferenceNumber');
CBTData['CBTTrainingModuleID'] = CBTPlayer.GetVar('EEO CBT');
CBTData['CBTSlide Number Last on'] = CBTPlayer.GetVar('Slide No');

Ashley Terwilliger-Pollard

Hi Stefne,

I also wanted to share a reminder in regards to ensuring that you're testing the published output within the intended environment as the Javascript won't run in preview and it may not work correctly when testing the published output locally as described here. 

You may also want to review our best practices here for working with Javascript. 

This discussion is closed. You can start a new discussion or contact Articulate Support.