That seems awfully vague. There are a few people who are pretty good with JS in the community but we all have different areas of strength. Can you provide some detail? What is it you are trying to do?
Here's some more info. Let me know if you have any other questions.
The user’s email needs to get added to the URL so they are directed to the correct simulation. Here’s the URL with email address noted as %emailAddress%:
On the screen to launch the simulation, we want a text entry field for the user to enter their email. Then they would press a button to launch the URL and the URL with the email address would need to be used.
The user supplied variable will come from the SL file.
In StoryLine, create 3 text variables: URLPart1 with the default value of http://mdt.mentorlearn.com/AppStreaDemo.html?userID= URLPart2 which will store the user's email address URLPart 3 with the default value of &simTypeID=4&moduleID=35&caseID=1
You will need an input field for the user to provide their email address and it should be stored in the URLPart2 variable.
Next, you will need a trigger to execute your JS code. Here is your JavaScript code (untested):
//Make a call to the SL player var player=GetPlayer();
//Access all 3 parts of the target URL var urlPart1 = player.GetVar("URLPart1"); var urlPart2 = player.GetVar("URLPart2"); var urlPart3 = player.GetVar("URLPart3");
//Concatenate the URL var targetURL = urlPart1+urlPart2+urlPart3;
//Open new window with the target url myWindow = window.open(targetURL); myWindow.focus();
What online community or course (trainings) would you recommend for someone who wants to learn javascript so they too could come up with slick suggestions like you offer?
Do you have any courses on udemy or such?
Thanks so much for your response and for being a HERO!!
What I know about JS, I learned primarily from this community, asking questions, challenging myself and googling for solutions. I'm only scratching the surface!
What I will tell anyone who will listen is this, don't let it intimidate you. You don't have to be "tech savvy" or a "programmer" to learn some basics and apply some code to your courses.
I haven't developed any course work on JS (maybe I should) but I have presented some JS basics at learning conferences and Articulate Roadshows.
Of course, I'm always happy to help out here as well.
There's a good free tutorial here to get you started with the syntax of javascript https://www.w3schools.com/Js/ I've learned a lot from looking at code that others have posted here. Also, if I'm trying to accomplish something in particular, a Google search usually lands me at the stackoverflow web site where you will find lots of sample code for doing different things in javascript.
11 Replies
That seems awfully vague. There are a few people who are pretty good with JS in the community but we all have different areas of strength. Can you provide some detail? What is it you are trying to do?
Hi Owen!
Here's some more info. Let me know if you have any other questions.
The user’s email needs to get added to the URL so they are directed to the correct simulation. Here’s the URL with email address noted as %emailAddress%:
http://mdt.mentorlearn.com/AppStreaDemo.html?userID=%emailAddress%&simTypeID=4&moduleID=35&caseID=1
On the screen to launch the simulation, we want a text entry field for the user to enter their email. Then they would press a button to launch the URL and the URL with the email address would need to be used.
The user supplied variable will come from the SL file.
In StoryLine, create 3 text variables:
URLPart1 with the default value of http://mdt.mentorlearn.com/AppStreaDemo.html?userID=
URLPart2 which will store the user's email address
URLPart 3 with the default value of &simTypeID=4&moduleID=35&caseID=1
You will need an input field for the user to provide their email address and it should be stored in the URLPart2 variable.
Next, you will need a trigger to execute your JS code. Here is your JavaScript code (untested):
//Make a call to the SL player
var player=GetPlayer();
//Access all 3 parts of the target URL
var urlPart1 = player.GetVar("URLPart1");
var urlPart2 = player.GetVar("URLPart2");
var urlPart3 = player.GetVar("URLPart3");
//Concatenate the URL
var targetURL = urlPart1+urlPart2+urlPart3;
//Open new window with the target url
myWindow = window.open(targetURL);
myWindow.focus();
See Demo
Let me know if that works for you.
Hi Owen,
That worked like a charm! Thanks for your help. Can I compensate you for your time?
Thanks
Rob
Glad it worked out for you. If our paths ever cross at a conference, you can buy me a beer. :-)
Sounds good! Thanks again.
Excellent solution, Owen. I had an idea for this, but your solution was much better. I love learning from the masters here. :)
Me TOO!!!
Hi Owen,
Just dropped in here to ask you a question...
What online community or course (trainings) would you recommend for someone who wants to learn javascript so they too could come up with slick suggestions like you offer?
Do you have any courses on udemy or such?
Thanks so much for your response and for being a HERO!!
Take care
Thank you for your kind words!
What I know about JS, I learned primarily from this community, asking questions, challenging myself and googling for solutions. I'm only scratching the surface!
What I will tell anyone who will listen is this, don't let it intimidate you. You don't have to be "tech savvy" or a "programmer" to learn some basics and apply some code to your courses.
I haven't developed any course work on JS (maybe I should) but I have presented some JS basics at learning conferences and Articulate Roadshows.
Of course, I'm always happy to help out here as well.
There's a good free tutorial here to get you started with the syntax of javascript https://www.w3schools.com/Js/ I've learned a lot from looking at code that others have posted here. Also, if I'm trying to accomplish something in particular, a Google search usually lands me at the stackoverflow web site where you will find lots of sample code for doing different things in javascript.
This discussion is closed. You can start a new discussion or contact Articulate Support.