Validating a Text Entry Box in Articulate Storyline

Validating a Text Entry Box in Articulate Storyline

In my previous blogs, I have shared how we can develop courses, where learners are able to email the trainer, using JavaScript. But, in these courses, we enter the email ID that is present only inside of the JavaScript. Here, I would like to explain how the learner can mail to the email ID of his choice. He enters an email in a text box and the text box should be validated. The learner should be restricted to enter the email ID only in the provided text box.

Here are the steps to validate a textbox.


Insert a Text Entry Field.

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

Step 1

Here, we want to validate this text entry field where user must enter only email IDs. 


Create a Boolean variable Validate with the default value “False”.

Step 2


Rename the variable “TextEntry” as “Email” for our convenience.

Step 3


Add a trigger such that “Adjust variable Validate to false when the slide timeline starts.”

Step 4


This is an important step. Here, we can execute the JavaScript.

Add a trigger as “Execute JavaScript when Control loses focus on TextEntry

Add the below code in the JavaScript window.

Step 5

var check = /^\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

var player = GetPlayer();

var email=player.GetVar(“TextEntry”); 

var Validate=false;

if (check.test(email))


var Validate=true;




var Validate=false;




Now insert a button named “Submit”, and add trigger such that “Jump to next slide when user clicks the “Submit” button” on a condition Validate is equal to “True

Step 6


Now, publish your course and check the output.

Hope you find this blog useful. Do share your views.

How to Select the Right Rapid Authoring Tool