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
- KawstovFLIPCommunity Member
Hi Julie,
You can find reference here:
http://www.articulate.com/support/kb_article.php?product=st1&id=llwes8cn32vg
I suppose this should work.
Step 1. Create 3 variable in SL: email, subject, body_start
As the name suggest, they will contain respective content. You can fill them.
Step 2. Create a button and put a trigger to execute javascript, when clicked:
----------------------------------------------------------------------------------------------
var player = GetPlayer();
var email = player.GetVar(“email”)
var subject = player.GetVar(“subject”)
var body_start = player.GetVar(“body_start”)
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');
-----------------------------------------------------------------------------------------------------------
If you want to email it directly, without opening outlook, (which i think is neater), goto this thread:
http://community.articulate.com/forums/p/34669/191317.aspx#191317
Do tell me, if you face any problem.
Regards,
Kawstov
- ShaneTraynor-efCommunity Member
Just a minor correction, the variables should be between apostrophes, not quotation marks:
var player = GetPlayer();
var email = player.GetVar('email')
var subject = player.GetVar('subject')
var body_start = player.GetVar('body_start')
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
win=window.open(mailto_link,'emailWin');
Hi Julie,
We have a number of Javascript gurus in the community who can hopefully help you, and if you need anything else please let us know!
- JulieHollandCommunity Member
Thanks Ashley! I'm hoping someone can help. My deadline is approaching (9/10) and I'd love to get this working
Looks like someone came to your rescue Julie! Thank Kawstov!
- JulieHollandCommunity Member
Hi Kawstov,
Thanks so much for the reply. I see where you're going with the variables...unfortunately, I have a TON of feedback slides so this would add a lot of extra work for me. I was hoping to be able to write a piece of code on the Feedback Slide Master that pulls in whatever text is located on the Feedback slide and adds it to an email. We are a paperless company, so I was hoping for an electronic way for the user to send/save the data in the text body.
I met with one of our Developers today and he was trying everything on the message boards and wasn't able to get it to work.
Guess I will move this functionality to Phase 2 of the project.
Thank you!
Julie
- KawstovFLIPCommunity Member
Hi Julie,
I faced the same problems in one of my project. If we keep the same variable, the work can be minimized.
Can I get a sample of your project, so that I may see how we may work through it.
Regards,
Kawstov
- JulieHollandCommunity Member
Thanks for the replies! I decided to go a different route. I’m working with our IT department to create a hidden folder on our network that only has “Read” access. I’m going to create a slide at the end of each path in my branching scenario that has a triggered button or hotspot (see image below) which will launch the user out to a file. I’m creating my feedback documents in Word and then going to .pdf them so the user can Save or Print them.
I wish there was an easier way to Print (and email) content that is located on slides in Storyline. I hope they add this type of functionality to future Storyline updates.
Thank you,
Julie
Hi Julie,
Thanks for sharing your workaround and I like the graphic. As far as the email feature - it's something that we have purposefully not included. For the printing, you may want to submit a feature request about it.
- PhilMayorSuper Hero
James Kingley has a great print widget on Elearning Enhanced and it is cheap.
- JulieHollandCommunity Member
Hi Phil,
I contacted James about his widget. Unfortunately, I had a scrolling panel on the slide that I wanted to print and his widget only printed what was on the screen. The text below the scroll bar would not print using his widget.
Thanks!
Julie