Help With JavaScript code for Text Entry Printing in Storyline 360

Aug 15, 2022

Is anyone who is experienced in JavaScript willing to look at my code and tell me if you see anything wrong with it?

I'm trying to pull multiple text entry answers so the learner can print them all at the end of the course. It's code I've pulled from another course that works perfectly in that course, but somehow is not working in this new one.

I'm testing it in Review 360 and on Chrome. Those are the same conditions that I'm able to get the other course to work in, so I assume those aren't the issue.

When I click the button, nothing is launching or triggering at all. I'm using Visual Studio Code to write it and then copying and pasting into the execute javascript trigger in Storyline.

I've attached a sample of the project here, which is the last few slides and the print button. Any help anyone could offer would be so appreciated!!

17 Replies
Math Notermans

Finxing that by changing the "bad guy" to 'bad guy' and it works... well partially...

e2
As you can see, the window opens but a lot of the info in it is 'null'
As you can see the text input field works though.. i filled 'Jabbadabba doe'  in...
jabba

;-) Thats the only variable in your sample..so it basically works...

Ashley Burge

You have saved the day!! Or my day rather. Thank you so very much.

It's amazing how something that small can cause issues. I've look in developer tools, but reading it sometimes feels like a foreign language, so the learning journey continues! 

The print button itself, in the launched window, doesn't work, but that's okay because they can still click Ctrl+P and that will trigger it. And for now, that will have to do! Thank you!!!!

Stacy Springer

Hi Phil, I am trying to print variable responses to PDF. This has worked in the past (March 2022). I have been testing the published version on my Review 260 with Firefox's web dev tools. Here are the errors I get:

Still tracking the issue with Firefox developer tools: Here are the errors when the button is pressed:

actionator::exeJavaScript - this.execUserJs is not a function bootstrapper.min.js:2:149273


Referrer Policy: Ignoring the less restricted referrer policy “no-referrer-when-downgrade” for the cross-site request: https://n.clarity.ms/collect 840.39dbb679ee07e8aa.js:1:37488

I have attached my Javascript. Also, I still get the same thing when my Javascript is just Window.print();

The previous media piece that uses the same script still works (Published in March 2022) is here: https://360.articulate.com/review/content/8f330d28-988d-40fa-acee-106a09d76f4a/review

 

Phil Mayor

As all of the JavaScript in a course is published into a single file. A syntax error in one will break all the other code. Have you tried the window.print in a course with only that code? It looks like you may have a code error but without seeing the code it is difficult to say where.

Sent from my iPhone

Stacy Springer

This issue has been resolved! If you have problems with your JavaScript, here are the troubleshooting steps that helped me (compiled from things found on the web):

1. Take the JavaScript and button and copy them into a blank Storyline file. Publish and test. In my case, the button worked.

2. Look at any JavaScript in the Storyline file that may have errors.

3. Use the Web Dev tools in your browser to identify errors.

4. Check your Slide Masters for any issues.

5. Don't edit your code in Microsoft Word. There is a difference in quotation marks that can cause an issue.

6. Check that your browser is not blocking JavaScript.

7. Change your JavaScript file to show just one command such as print.window();

8. Don't be afraid to ask for help, another set of eyes is really helpful!

My problem was that I had a hidden slide out there where I was working through sliders and dials, specifically retrieving and setting the variables. The issue was there. Once I deleted that slide, my JavaScript button started working. Hopefully, this helps others.