Forum Discussion
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: https://bit.ly/3Kd96as
Published Output: https://bit.ly/3Z0hj5X
Cheers!
Stephanie
237 Replies
- OwenHoltSuper Hero
If your email is not html based, you would need to convert the break to the following hexadecimal equivalent of a carriage return that the computer would then recognize: %0d%0A
So using James suggestion above, try something like the following JS:
your_string.replaceAll(new RegExp('\n', 'g'), '%0d%0A');You can learn more about the 0d0a pair of characters as the signal for the end of one line and the beginning of another one HERE.
And to steal James' line.... Your mileage may vary on the code above as I didn't test it before posting it here....
- TroyAshmanCommunity Member
I love these posts, especially about Javascript as I find it so dynamic.
I'm still fresh to Javascript and have been using it for a note taking portal for users to take notes and email them upon completion. I've been asked if there is a way to have the user click on a specific sentence on a page in SL and have the text copy to the note taking portal for them to add / remove text as pleased and then email themselves upon completion.
Is anyone aware of how to do this or if it's possible?
- TroyAshmanCommunity Member
Thanks Matthew, I thought that'd be the case. I think this would become increasingly difficult to update, especially if I had to pass it onto an SME to update the copy etc.
I'll keep digging for ideas, thanks.
- roneltaruc-5c94Community Member
Thank you everyone for your helpful suggestions :)
- onEnterFrameCommunity Member
Sorry Ronel, I accidently mixed jQuery with standard JavaScript. The code should be:
your_string.replace(new RegExp('\n', 'g'), '<br/>');
I made a short video to help explain/demo it: https://youtu.be/hskTmJgMTyc
- roneltaruc-5c94Community Member
I know the Articulate community's reputation for being helpful is something to be proud of but you Mr. Kingsley definitely proved that as an understatement. You even bothered to create a video tutorial for me :D Very grateful for this community and glad to inform you guys that my issue is solved 100%. THANK YOU.
- roneltaruc-5c94Community Member
Hmm.. bumped into another problem. How come when I add the highlighted lines, storyline does not trigger the email window to pop up anymore? I am using Outlook btw. But without those lines, the email window pop ups just fine. Any help? I attached the whole java script if you need to see it. Thanks!
- onEnterFrameCommunity Member
A few thoughts on this...
- Although the spec for hyperlinks (including mailto) does not define a maximum length, most browsers (and email clients) do. I am not certain what the current maximums are.. but IE's is 2083 characters. You are likely hitting a limit.
- Have you tried it in a browser with the Developer Console open? It should list the details of an errors in the console.
- Could there be issues with the values of that set of variables (fbk89-93)? Perhaps more invalid characters etc.
For something this complicated I might suggest you display the data in a new HTML page with options to print/save as pdf. Then they can email the PDF.
- HedrickEllisCommunity Member
Hi Articulate Community, this is my first post. I know this thread started a while ago but it still seems active since the ability to email and print notes is so cool! Hopefully, someone can help me. I've attached a Storyline file which is a stripped down version of the functionality that Stephanie demoed.
When I click the email button and print button nothing happens. (I've published the file, not viewing in preview). I've also copied the Javascript for the email piece below in case that might be helpful.
var player = GetPlayer();
var useremail=player.GetVar("email");
var subject="ECERS Class Notes";
var usernotes=player.GetVar("notes");
var exercisenotes1=player.GetVar("TextEntry2");
var exercisenotes2=player.GetVar("TextEntry3");var mailto_link='mailto:'+useremail+'?subject='+subject+'&body=
'+"Activity Notes - My thoughts on the strengths of our program:%0d%0A"
+exercisenotes1+"%0d%0A%0d%0A
Activity Notes - Challenges in our program:%0d%0A"
+exercisenotes2+"%0d%0A%0d%0A"+usernotes;win=window.open(mailto_link,'emailWin');
- moodleberryCommunity Member
I know this is an old post, but thanks so much for sharing, this has been a life saver as I need to print a report from the current package I'm working on, and this works perfectly.
Just a note: when I used the date I got 13rd rather than 13th, I've found a comment on the following post with code that works so it will do 1st, 2nd, 3rd but not 13rd, in case it's useful for anyone.
(Courtesy of Mark Bennett)
var today = new Date();
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var s = ["th","st","nd","rd"];
var day = today.getDate();
var month = today.getMonth();
var year = today.getFullYear();
var v = day%100;
var dd = day+(s[(v-20)%10]||s[v]||s[0]);
var date = dd + " " + monthNames[month] + " " + year;
var player = GetPlayer();
player.SetVar("SystemDate",date);- onEnterFrameCommunity Member
That's a great solution. I often use this JS library when I need to
display/manipulate time or dates.
https://momentjs.com/Thank you,
James KingsleyNeed an awesome way to collect feedback?
Don't just collect feedback. Start a conversation.
ReviewMyElearning.com - KatieRoberts-18Community Member
Did you get this resolved? I am running into the same issue.
- BredellEvansJrCommunity Member
Hi Stepanie,
I have a question that I really need your help with. I am wanting to do the exact same thing you did with sending notes to an email, but with what I am doing I am unsure of how to customize yours for what I am trying to do. Would I be able to possibly send you the storyline file of what I am doing and get some input of what I might do? Thanks so much for your post sharing
- OwenHoltSuper Hero
You could post your file here and seek feedback from the community. I'm not sure how often Stephanie looks at this thread. Just use the "ADD ATTACHMENT" button when you post.
Related Content
- 9 months ago
- 7 months ago
- 8 months ago
- 9 months ago
- 12 months ago