Train the Trainer eCourse: Microlearning Nuggets
Share Twitter Facebook LinkedIn Google+

Posting an E-mail Using JavaScript in Articulate Storyline

Written By

Posting an E-mail Using JavaScript in Articulate Storyline

Did you ever have a requirement, which states that the learner should  be able to mail the trainer directly from the eLearning course. If so, can you satisfy the requirement using Articulate Storyline? – Yes. Let us now see how we can meet this requirement.

Step1:

Insert a text entry field.

 Inserting a text field

When we insert a text entry field the “TextEntry” variable will be created automatically.

TextEntry variable created automatically

Here we used this text entry filed as a subject of the email.

Step2:

Insert two another text entry fields for “Greetings” and “Body text” of the email.

Inserting two more text fields

So we have total three text entry fields and three text variables ( TextEntry, TextEntry1, TextEntry2 ).

Displaying three TextEntry variables

Step3:

Insert a button and give a trigger to that button such that “Execute JavaScript when user clicks button”.

Inserting a button and giving action to it

Step4:

It is an important step. Here we should write a JavaScript.

Double click on the Execute JavaScript trigger.

Double click on the trigger to open the script window

Click on the “Add/Edit JavaScript” button to write a script.

 Click on add(or)edit JavaScript button

Then an empty window will open to write your JavaScript.

Java code for posting text into email

In the above image,replace “your_email@domain.com” with a valid email id.

Now the coding is complete and it’s time to check the output. You will be  not able to watch the output of the JavaScript, while previewing the file. It is visible only after publish the course.

This is how we can give an option to learner to mail the trainer directly from an eLearning course. Have anything to say? Please do share!

View eBook on Articulate Storyline for Building E-learning Courses

Share
Topics: , ,

Subscribe to Our Blogs

Get CommLab's latest eLearning articles straight to your inbox. Enter your email address below:

 
eLearning Learning
  • LaKeisha Coleman

    Is there a way to email the results of an assessment to the an email address that is entered on the screen. For example. By default when you click on Print Results it prompts you to enter your name. I would like to also have a field come up that also asks you for your teacher’s email that will automatically email that teacher the results.

  • G Vijay Kumar

    Yes LaKeisha Coleman , We can do it.

  • Vijay

    Hi Mark,

    here is the code.

    var email=”Your_email@domain.com”;
    var player = GetPlayer();
    var subject=player.GetVar(“TextEntry”);
    var body_start=new Array();
    body_start[0]=player.GetVar(“TextEntry1″);
    body_start[1]=player.GetVar(“TextEntry2″);
    body_text = body_start[0] + body_start[1] ;
    var mailto_link=’mailto:’+email+’?subject=’+subject
    +’&body=’+body_text;
    win=window.open(mailto_link,’emailWin’);