JavaScript Email Validation in HTML5 using SL2

Feb 03, 2017

I am currently experiencing an issue with email validation when publishing with HTML5 support. My story.html file works like a charm, but when I access the story_html5.html the validation is not working and my button and some triggers don't work properly.

I'd like to post my project in private due to the nature of the course.

12 Replies
Bryan Mendelson

Thanks Phil. The code is pretty straightforward. I feel it is an issue with Storyline and not JavaScript. I just cant figure it out.

// for textentry
var reg = /[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*/g;
var player = GetPlayer();
var email=player.GetVar("storemanager1");
// console.log(email);

var isValidate=false;
if (reg.test(email))
{
var isValidate=true;
}
else
{
var isValidate=false;
}
player.SetVar("isValidate",isValidate);

 

This discussion is closed. You can start a new discussion or contact Articulate Support.