Function Keys Interactivity in Storyline Using JavaScript
Feb 07, 2013
I am creating simulation for a software in storyline. This simulation has function keys interactivity - F2,F3,F10,F11.
I was able to write trigger code - Jump to Slide when user presses F3 keys.
When I am publishing this project, the function keys are responding to the browser function keys. e.g. when I press F3, instead of going to slide F3, its showing browser's find feature.
I tried to do research on google and articulate forum for how to use functions for simulation its leading me JavaScript.
I understand that I need to use trigger - Excute JavaScript in Storyline.
But I don't know how to write a javascript.
I need JavaScript which will disable browsers function key e.g. F3 and if user presses F3 it should go to the next slide.
I guess I need two JavaScripts; the one which will disable browser's function key, and the other which will assign the user defined function that is go to F3 slide if user presses F3 funciton key.
I know there are tons of website which will give you javascript code. But I find it difficult execute in the Storyline.
I have created an example and uploaded the storylline file in this message.
Please help me to write the javascript in storyline.
Thanks in Advance.
48 Replies
Where do you enter this script? I am not fully understanding.
This post was removed by the author
Do we open the html file in note pad to make the change? Not sure where to go in note pad to in my case disable F1 and F4.
Add a trigger to execute JavaScript when your slide timeline starts. Copy and paste the code into the JavaScript code window in StoryLine. Once published, the function keys should become disabled when the slide timeline starts.
I have to confess when I did this I created a fake keyboard at the bottom of the screen with the F keys. :-)
My comment is in respect to a fairly old thread, I know. I just want to say thanks to those who contributed and especially to Owen for supplying the .story files. I am about to do a simulation of a mainframe system that uses F-keys and it looks like the information supplied in this thread will really come in handy - and make me look really good in the process. ;)
Thanks again to all.
I am building a course that mimics a mainframe system (HIMR) and I am experiencing some difficulties with what I will call "non-standard" keys. For instance, I need the learner to input a text string with a Tab key; another example is using a combination of keys (Shift+F1) to perform an action.
I have loaded a test version of the course to the LMS for testing, and I am not only getting incorrect results, but their actions differ from one browser to another.
I won't go through the trouble of uploading my .story file here unless this thread is still live. If it is, and if someone might be able to lend a hand, it would be greatly appreciated.
Thanks
Stuart Gilbert
Stuart - For my part, I could only get Chrome to work properly. I ended out Putting a disclaimer at the beginning of the course that you must complete the course with Chrome. Since then I haven't had any learners with issues.
That's exactly what I didn't want to hear. :) It sounds like it's exactly what I will have to do as well.
Thanks very much for letting me know.
Someone else may be better able to find another solution or understand, but the explanation I found was something to do with the coding of IE. the Javascript will not override IE's functions; whereas, Chrome is able to support the override.
Owen,
I assume I'll need to include the Execute Java Script trigger, correct? If I could ask a stupid question - What JavaScript does it execute, and where does it get it from?
Thanks very much.
Stuart
When you open the F-Key_Test_V360.story file Owen had shared, you'll see an Execute Javascript trigger. Double-click the trigger and then click on the Script --- button to see the script that is being executed.
Thanks for the assist Michael. I'm not sure why/howIi became unsubscribed to this thread. (Or maybe work is marking email as spam?)
Hi Owen - this is genius! Wondering if there are any scripts to also disable the arrow keys? My interaction required the down arrow to show slide layers using the press key trigger. Seems to work on the first layer but i can't keep pressing the down arrow AND move up several layers. It breaks after the first. Any thoughts?
Here you can find all keycodes… and thus disable any key wanted.
https://css-tricks.com/snippets/javascript/javascript-keycodes/
Arrow keys are 37,38,39 and 40...
Hi to all the smart people on this thread. I recognize all of you from other places in the community.
I just was directed here by Joe Tansengco and I can't figure out how to apply the insights here as my javascript skills are limited. I tried following the conversation but I can't untangle it.
I am working on a free form question interaction that is a text entry question. I noticed that if I hit the Enter key to advance to a new line within the text entry box, the "Thank you" layer pops up prematurely. I was hoping there would be a way to avoid this or disable the enter key for this interaction. I think learners may hit Enter to advance to a new line if they are typing. We are not trying to track the response as correct/incorrect so I just chose a "Thank you" layer once the interaction is completed. As I understand it, my client's LMS has the capability to see what people have typed--they don't need it graded, they just want visibility into what people have typed. Maybe I just have my question set up incorrectly. If there is a better way to do this, I'm open to it. I was even looking at using the built-in survey question as an alternative. Any ideas? I attached my file for reference. Thank you!
Hi Jodi,
First i tried to get it fixed using Javascript, but soon noticed that especially the built-in questions in Storyline are very tied up in the code of Articulate, thus sometimes hard to change. So i reworked your sample to using a normal input textfield...and then it works nice without any need for Javascript.
Basically i just added a normal textinput field and used the data in that to change the values of the question textArea input. Then internally the submit doesnot get triggered and all works fine.
Thank you Math. I appreciate the time you took to help me work through this. I think I might try using the short answer survey or essay survey question too. My client wants to read the response in the LMS and the survey questions don't have that Enter key issue. On the positive side, I learned if you press shift+Enter you can advance a line in the text graded question without submitting the interaction, but that's an extra step. Have a happy New Year!
Hi All,
How can we restrict the use of Enter key for submitting Numeric Entry? What could be the best workaround? I have already tried adding layer but it is bypassed and JS doesn't work either. Please help.
Thanks in advance!
Hello Vt Sub! Welcome to the community! I saw a similar thread over here about the Enter key in case you want to check it out. A few community members shared their solutions there.
Any other solution, Sarah? No luck here :(
I have already checked and tried out these, but seems it cannot be controlled.
Sorry, VT Sub! You're right. Pressing the Enter key on the keyboard submits the response. I don't know of any other workarounds. Perhaps the community might have a solution to share. 🤞
Do share a Storyline sample and i see if i can fix it.
in fact i do think the newest version of Storyline has this build in.
As you can see here in Form View... you can clear any Submit Keys or enter your own.
Hi Owen, do you have the script that would do this?