Printing and email from Storyline - Javascript help please

Aug 24, 2021

Hello!

I've been watching tutorials on using JavaScript for printing and emailing gathered content (from variables) throughout the module. I even downloaded a source file WITH the JavaScript and customized the variables in the script to my content, however, I am unable to get this functionality to work. Can someone look at my source file and JavaScript set me straight?

6 Replies
Math Notermans

Hi,

1 error found in your script. Referring to 'email' in the variable mailto_link whereas you set your emailadress to sent to to useremail at the start of your code.
Also exchanged all the %%0d%0A-Mumbojumbo% for escape('\r\n').
That returns a new line. As most email-clients use HTML-formatted text, the %0d%0A-codes will not work.

Adding it working..
Kind regards,
Math Notermans

Math Notermans

Hi Elizabeth,

What you missed now was the variable date. If you publish as Web and open up the web developer tools in your browser ( CTRL+Shift+I in Firefox ) in the console there you can see whats going wrong and troubleshoot your title. With the Javascript console.log("am i working now ?"); you can message anything to your console and thus see if all works and when and where something doesnot work anymore. And thus find the spot where something goes wrong. In this case it was easy as on publishing the console immediately showed that the variable 'date' was not defined anywhere... thus telling me that was missing.

So i added code that gets the current date and sets that to the variable 'date'.
And then it works fine ;-)

Kind regards,
Math