User notes that they can print and email

Hi all. I built a course earlier this year that contains a "notes" function to allow users to take a moment to reflect and type their thoughts on certain questions. This is used in place of a typical multiple response/choice type question. Thought I'd share it here with you!

Here are the files:

Screenr Part 1: Demonstration - https://player.vimeo.com/video/204928444

Screenr Part 2: How It Was Built - https://player.vimeo.com/video/204928450

Storyline Source: http://bit.ly/INWKD7

Published Output: http://bit.ly/1gmwbnb

Cheers!

Stephanie

229 Replies
Lisa Treece

Hi Everyone!

I ran across this post last week when trying to figure out this whole Java thing (I have zero experience), and I'm hoping to get some advice :)

I am attempting to have an email populate with different variables in the body of the email The variables are numbers, not text, so I'm not sure if that makes a difference. I've tried adjusting a few of the different scripts I've found in this thread, but I can't seem to get any of them to work. Here is my most recent attempt:

var player = GetPlayer();
var email= "dbs_training@cscglobal.com";
var subject= "DNS Certification Assessment Results";
var score = player.GetVar("Results.ScorePercent");
var dnsbasics = player.GetVar("dnsbasics");
var zonebasics = player.GetVar("zonebasics");
var digsandzonechecks = player.GetVar("disandrcz");
var zonemanagement = player.GetVar("zonemngmt");
var reportingtools = player.GetVar("reportingtool");
var troubleshooting = player.GetVar("trblshooting");
var advancedzones = player.GetVar("advancedzones");
var urlf = player.GetVar("urlf");
var dnsa = player.GetVar("dnsa");
var emailbody = "End Score:\n\n"+score+"\n\nDNS Basics:\n\n"+dnsbasics+"\n\nZone Basics:\n\n"+zonebasics+"\n\nDigs and Registry Zone Checks:\n\n"+digsandzonechecks+"\n\nZone Management in Domain Manager:\n\n"+zonemanagement+"\n\nDNS Reporting Tools:\n\n"+reportingtools+"\n\nZone Troubleshooting:\n\n"+troubleshooting+"\n\nAdvanced Zones:\n\n"+advancedzones+"\n\nURL Forwarding:\n\n"+urlf+"\n\nDNS Advanced:\n\n"+dnsa;
var mailto_link='mailto: '+email+'?subject='+subject+'&body='+emailbody;
win=window.open(mailto_link,'emailWin');

Any advice would be much much much appreciated!

Thanks, Lisa

onEnterFrame (James Kingsley)

It is hard to trouble shoot without access to the course. 

One thing you could to help would be to open up your browser's developer console (press F12) and see if there are any error messages there. It will usually even direct you to the problematic line and might give a hint about what is wrong. 

In the meantime... a few things to check. 

  • This probably when run locally so make sure you testing from a web server.
  • I'm not sure you can access quiz results like this player.GetVar("Results.ScorePercent");  You may need to set the value of a custom variable in Storyline and get that. 
  • Since this solution is popping up a new window the browser could be blocking poppups. 
Jacob Visovatti

Hi Stephanie and others. I love this design!

I would like to provide users a workaround in case their browser's security settings prevent the Javascript from executing. I hoped to compile all the notes in a scrolling panel so that users could copy and paste, but now I realize that player text is not select-able.

Is there a way to enable copy and paste for on-screen content?

Jacob Visovatti

Hi Matthew - thanks for replying on a two-year-old thread!

My concern about browser security settings is entirely pre-emptive. I haven't finished building the functionality in my project yet, actually. I am trying to be robust in design, but I guess there's the Knuth quote - "premature optimization is the root of all evil."

Dave Galvin

Hi all,

This method for capturing notes during a course and emailing them, has really helped me in a few of my recent modules, thank you Stephanie!

I do have a question:

Instead of typing the target email address in a text field, and then executing the JavaScript, is there a way to use the email trigger in a button for instance, where you can add the email address upfront? In the course I am working on now, I have been asked if there is a way to do this, where the learner doesn't have to type an email address in a text box. If I can pre-populate that address, that would be great.

Thanks in advance

Regards

David

Matthew Bibby

Hi David, 

Yes, that's possible. Rather than hardcoding the email address into the JavaScript, e.g.

var email = "dave@galvin.com";

You'd use something like this instead:

var email = player.GetVar("Email_Address");

Then you'd just need to have a text entry field in Storyline where the user can enter their email address. You'd set this text entry field up to use the  Email_Address variable so that it all works.

Does that make sense?

I also have a detailed tutorial here on using email in SL that you might find interesting.

Let me know if you need any further assistance. Thanks.

EDIT: I just realised I answered the exact opposite of your question! Sorry about that.

You can either hard code the email address as shown above, or you may be able to grab the email address from the LMS if your LMS stores the user's email address as a  studentID. Some do, some don't. 

Dave Galvin

Hi Matthew,

Thanks for the information. The solution in your tutorial looks really good. In my module, I currently have three text box variables, each one asking a question for specific feedback from the course. Can I combine these so that they feature in one email, or do I have to create three separate emails?

Regards

David

Matthew Bibby

Hey Dave - they can be combined into the one email quite easily.

In my tutorial, you'll see this line of code:

var emailBody = 'Here is some feedback:' + '\n' + fbk; 

You could expand that to include your other variables easily. For example:

var emailBody = 'Here is some feedback:' + '\n' + fbk + '\n' + fbk2 + '\n' + fbk3; 

You'd also need to modify the code to grab the extra variables from SL, but I think you can probably figure out how to do that from the tutorial. If you get stuck, feel free to reach out and I'll help you get it working.

Thanks!

Dave Galvin

Hi Matthew,

That is great. I adjusted the script as below and all works as hoped.

var player = GetPlayer();
var email = 'my.email@address.com'
var fbk = player.GetVar('Feedback');
var fbk2 = player.GetVar('Feedback2');
var fbk3 = player.GetVar('Feedback3');
var subject = 'Course Feedback';
var emailBody = 'Here is some feedback:' + '\n' + fbk + '\n' + fbk2 + '\n' + fbk3;
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(emailBody);
win = window.open(mailto_link, 'emailWin');

Two quick questions if I may:

  1. Will this work in a LMS?
  2. Is there a way of stopping a blank tab opening at the same time as the email?

Thanks again Matthew!

Regards

David

Brian Sellors

Hey, this is amazing, but I am having trouble making it work. I am not sure exactly what needs to change in the java script. I am trying to make the email function work. This is what I put in (maybe i changed things i shouldn't have?). Any help would be great:

 

var player = GetPlayer();

var useremail=player.GetVar("email");

var subject="Trois type de reportage journalistic";

var quoi1=player.GetVar("TextEntry283");
var qui1=player.GetVar("TextEntry268");
var quand1=player.GetVar("Textentry270");

var mailto_link='mailto:'+useremail+'?subject='+subject+'&body=
'+"Notes Description de faits - Quoi:%0d%0A“
+quoi1+"%0d%0A%0d%0A
Notes Description de faits - Qui:%0d%0A“
+qui1+"%0d%0A%0d%0A
Notes Description de faits - Quand:%0d%0A“
+quand1+"%0d%0A%0d%0A

win=window.open(mailto_link,'emailWin');

onEnterFrame (James Kingsley)

It looks like some of your quotes are not closed. And there is a mix of different quote types: ',",and “

I am not sure if it is the formating of the post... but typicly you shouldn't break strings into multiple lines. If you do you will need to add a slash (\) at the end of each line.

This might work (untested but formatted better). Note that I just made the mail_to_link all one line and replaced the various quotes. 

var player = GetPlayer();

var useremail=player.GetVar("email");

var subject="Trois type de reportage journalistic";

var quoi1=player.GetVar("TextEntry283");
var qui1=player.GetVar("TextEntry268");
var quand1=player.GetVar("Textentry270");

var mailto_link="mailto:"+useremail+"?subject="+subject+"&body=Notes Description de faits - Quoi:%0d%0A"+quoi1+"%0d%0A%0d%0A Notes Description de faits - Qui:%0d%0A"+qui1+"%0d%0A%0d%0A Notes Description de faits - Quand:%0d%0A"+quand1+"%0d%0A%0d%0A"

win=window.open(mailto_link,"emailWin");
Brian Sellors

Hey James thank you so much for your response. I ended up using the following code and it seemed to work (I will also test the one you re-formatted for me thanks you for taking the time to do that [😊] ):

var player = GetPlayer();

var useremail=player.GetVar("TextEntry293");

var subject="Trois type de reportage journalistique";

var usernotes=player.GetVar("notes");

var exercisenotes1=player.GetVar("TextEntry283");
var exercisenotes2=player.GetVar("TextEntry268");
var exercisenotes3=player.GetVar("TextEntry270");
var exercisenotes4=player.GetVar("TextEntry271");
var exercisenotes5=player.GetVar("TextEntry272");

var mailto