If your Storyline 2 Javascript corrections aren't working try this

Nov 21, 2017

This might just save you some time if you're debugging Execute Javascript in Storyline 2.

I've just spent ages trying to figure out why some Javascript wasn't working. I discovered eventually it was a simple matter of upper/lower case i.e. I'd used 'setVar' instead of 'SetVar' . I went through and changed all the instances of 'setVar', uploaded to the server to test and was flummoxed to see it still wasn't working. I went back in, looked at one slide and it was still 'setVar'. Thought I must have forgotten that one, changed it and republished. Still not working.  I changed it again, closed the slide and, because I was feeling paranoid, re-opened it. It was back to being 'setVar'.  

To cut a painfully long story short, I discovered I hadn't been hitting Return at the end of the line after I'd changed the lower-case to uppercase. Once I did that, the uppercase S stayed uppercase. Perhaps this was because it was the last line in the code, I don't know, but I offer this in case it reduces frustration for someone else in future.

 

 

5 Replies
Walt Hamilton

When I'm debugging js, I publish and then open the user.js file in a text editor. (There are a lot of them that offer programming aids.) I generally work on a one slide project until I perfect the js.

I publish, run, and edit. Then I save and reload in the browser.

Once it is perfected, I copy it to the slide, and import the slide into the final story.

One thing to note, the user.js will have a header and an extra } at the end, so be sure you don't copy them into the slide.

Michael Anderson

Norman, I think you're encountering a bug in the Storyline Javascript editor window. If you opened your trigger to edit your Javascript code, but you ONLY changed upper or lower case and didn't make any other changes, Storyline would not save the changes. That's why hitting return at the end of the line worked for you to make the changes stick. This is a long-standing bug that I figured had been fixed by now, but I guess it has not.

I just checked and the bug still exists in Storyline 3.

Ashley Terwilliger-Pollard

Hi all,

I see some similar issues with the case sensitivity in editing the Javascript, but only if that is the only editing you change when editing the triggers. It sounds like you're seeing it happen no matter what is changed, that it reverts the case? If so, I'd love to have you work with our Support Engineers to confirm what you're editing and how that change is being represented in Storyline. 

Can you reach out here to them and I'll follow along? 

Norman Lamont

Hi Ashley - when I had this problem the only change I was making to the slide was the change of case in the Javascript on that trigger. I would change the case, exit the slide, re-enter and the case had reverted. If I added a Return it didn't revert, as noted by Michael above.  Still want me to speak to support engineers?

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