Forum Discussion
JavaScript ?: Can I pull text from a text box into an email?
I have very little JavaScript experience and would be forever grateful if someone could help me fix an issue.
I'm creating a very large branching scenario. At the end of each branch, we are providing coaching feedback to the user regarding the pros and cons of the path they chose.
Here's what I want the Email button to do:
- When a user clicks the Email button (see Image 1), I want an Oulook email to pop up.
- I would like the To: in the email to be left blank.
- In the Subject line, I would like to say "Leadership Challenge: Scenario 1 Feedback."
- In the body of the email, I'd first like it to say "Below is the feedback you received from Scenario1 of the Leadership Challenge. We encourage you to discuss this feedback with your Manager."
- I would then like to pull in the text from the Feedback slide (See Image 1).
I have some of the code written already (See Image 3). I can get the Outlook email to pop up and can populate the Subject line and the "Below is the feedback you received from Scenario1 of the Leadership Challenge. We encourage you to discuss this feedback with your Manager" text.
The only thing left that I need is to be able to pull the actual Feedback text from the slide into the Outlook email. Does anyone know if that is possible within Storyline?
Thank you so much!
Julie Holland
- TomWashamCommunity Member
Hi Everyone,
I'm attempting to add javascript to a button so that it launches an email. My script appears to be working in other projects but isn't launching an email in my new course. Is there anyone who might be able to look over the script and or inspect the project to help me troubleshoot? Thanks in advance for the review!
var email="twasham@company.com";
var subject="Feedback Needed AAA Level 1A Post-Test";
var player = GetPlayer();
var body_start=new Array();
body_start[0]=player.GetVar("question1");
body_start[1]=player.GetVar("question2");
body_start[2]=player.GetVar("question3");
body_start[3]=player.GetVar("question4");
body_start[4]=player.GetVar("question5");
body_start[5]=player.GetVar("question6");
body_start[6]=player.GetVar("question7");
body_start[7]=player.GetVar("question8");body_text = body_start[0] + "%0D%0A%0D%0A" + body_start[1]+ "%0D%0A%0D%0A" + body_start[2]+ "%0D%0A%0D%0A" + body_start[3]+ "%0D%0A%0D%0A" + body_start[4]+ "%0D%0A%0D%0A" + body_start[5]+ "%0D%0A%0D%0A" + body_start[6]+ "%0D%0A%0D%0A" + body_start[7];
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_text;
win=window.open(mailto_link,'emailWin'); - YvesBRISSETCommunity Member
var player = GetPlayer();
var useremail=player.GetVar("email");
var subject="VAE Engagement sur l' utilisation de velos a assistance Electrique";
var usernotes=player.GetVar("Note");
var exercisenotes1=player.GetVar("Note1");
var exercisenotes2=player.GetVar("Note2");
var exercisenotes3=player.GetVar("Note3");var mailto_link='mailto:'+useremail+'?subject='+subject+'&body='+"Activity Notes - My thoughts on the Non-Discrimination policy:%0d%0A"+exercisenotes1+"%0d%0A%0d%0AActivity Notes - Situations I would report to the Values Line:%0d%0A"+exercisenotes2+"%0d%0A%0d%0AActivity Notes - Examples of Conflict of Interest situations:%0d%0A"+exercisenotes3+"%0d%0A%0d%0AGeneral Notes:%0d%0A"+usernotes;
win=window.open(mailto_link,'emailWin');
may be if you replace by player.GetVar("question1");
you will have the response tell me if it work - PoppyHillCommunity Member
I am trying to let the user email a variable text to themselves using java script. I have 3 variable:
email
subject
body
I have tried and tried to plug these in to javascript, but I am inexperienced and can't get it to work! Can anyone help me with the script I should use?
Also, will javascript run on the HTML file vs. HTML5? Thanks!
Hi Poppy,
JavaScript triggers are supported in the Flash and HTML5 published formats. However, JavaScript is not supported in the Articulate Mobile Player for iPad. You may also want to review this article on Javascript best practices.
- MichaelHinzeCommunity Member
Maybe by copying the script, the character encoding got screwed up or extra line breaks were added. I recreated the script and it works for me, see here and attached.
- AlexanderLealCommunity Member
This works! Thank you Michael!
- JerremDavies-f5Community Member
3 years on and still works, thanks Michael!
Now its time to try learn xAPI!