Forum Discussion

ElizabethGar282's avatar
ElizabethGar282
Community Member
4 years ago

Printing and email from Storyline - Javascript help please

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?

  • 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

  • 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

  • Thanks Math.

    One last thing (promise): Clicking the Print My Notes button doesn't seem to do anything. Formatting and all that is great.

  • Hi Elizabeth,

    Well on my computer the printbutton shows a print window properly. So i guess thats more a specific issue with your computer settings then a Storyline or Javascript issue. Probably has something to do with default settings for your printing settings.


    Kind regards,
    Math