JavaScript no longer working!

Sep 15, 2023

Hi all,

I have been working on my first eLearning course around the ADDRESSING framework. After adding a bunch of interactions today (1.8 & 1.9) my Javascript trigger that was working last night is no longer working! I tried copy and pasting the button into a new course, and works there, so I'm guessing it's something I added today?

I have the same "print" triggers on three slides (1.11, 1.12, 1.17) and none of them are working anymore. Please help!

Thank you so much.

12 Replies
Megan Gee

Hi Walt, thank you - and yes! I thought I had attached the file, but will try again (just in case?). The buttons should be on the last layer of 1.11, 1.12, and 1.17. Please see screenshot of 1.11.

It's possible I'm missing something, so thank you for your patience.

 

Megan Gee

Thank you so much! I think I confused the files somehow, but now I see the corresponding slides you refer to. Unfortunately, slide 1.8 and 1.14 aren't working for me like they are for you though... to test, I've been publishing to the web and when I click the "print" button, nothing seems to happen. The window doesn't even pop up.

But again, when I copy and paste it into a new story, it works! The window pops up and I can see the questions associated to "exercisenotes." Thanks again for your patience - I'm new to Articulate and am very unfamiliar with JS.

Phil Mayor

I published each indivdually to make sure there was no JS that was broken elsewhere in the project

The problem is on 1.14 I didn't have time to debug this morning, I pasted it here JSHint, a JavaScript Code Quality Tool

To see if there were any errors, looked like a few, but also noted that the date a nd title variables are not in your project

Megan Gee

Hi there, after working with the file a little, I seemed to resolve the original issue. I'm not sure what exactly I did, but I'm glad everything seems to be working as designed!

One other thing... when trying to get the course to pull the current date/time, as well as adding a heading to each notes printout... I get "null." Can someone help me identify how to resolve these things? I don't want to mess with any of the code in fear of messing up what has already been resolved. File attached.

Thank you!

Nedim Ramic

As Phil pointed out, you don't have variables "SystemDate" and "PrintTitle" declared in Storyline. Also, in your JavaScript code, you say " var exercisenotes1=player.GetVar("csreflect1");" but on your layer with text fields, you refer to "csareflect1" (same issue with all 4 text variables). It appears that you have declared similar variables for the same purpose and mismatched them. 

Solution:
1. Create a blank text variable "SystemDate"
2. Create a text variable "PrintTitle" (I'm not sure what is the value you want to assign to this variable)
3. Slide 1.12: replace cs with csa in cs variables in JavaScript code on the Reflection Print layer

If you publish only slide 1.12 for testing purposes, the "SystemDate" will not show unless you place the Execute JavaScript trigger from the first slide (one that sets up the date) to Slide 1.12. Or you may place it on the Master slide to make sure it's always running.