Set Variable to typed value

So I have a data entry box on a slide in Storyline that the user must enter correctly before they can progress to the next slide. I see that the variable is set when the control loses focus, which works when the user clicks the next button. I also have my slides set up to progress to the next slide when the use pushes the right arrow key on the keyboard. I have necessary triggers set up to read the variable and decide if the user got the answer correct. However, when they push the right arrow key the response is wrong because control never lost focus. 

Is there a way to set the variable different?

9 Replies
Mark Woolwine

Perhaps I didnt explain the issue correctly. There is no problem with the triggers. The problem is with the control lose focus. When you type into a data entry field it sets the variable when the control loses focus. However, if you have a trigger set up to check that if you hit the right arrow key or any other key... the control doesnt lose focus and the variable is still empty. My question is.... is there a way to make the data entry field set the variable with out the control losing focus.

When you click the trigger for the data entry there is no way to change to something other than "when control loses focus"

Joseph Suarez

I'm running into this same issue with text entry fields and key presses because the text field variable is not set until the text field loses focus.

So the user types text into a field, hits enter, and as far as Storyline can tell nothing has been typed because the focus is still on the text box and thus variable never changed.

Is there a way to change the focus with a trigger so pressing a key to "submit" immediately after typing can work correctly?

Note: I'm using a regular content slide, not a question slide because the enter key has a other issues there.

Steve Flowers

Couple of ways I can think of to do this. One is a little delay on the execution of the trigger for submission. 

Clicking the button should unfocus the field. If the trigger on this field opens a layer with a short delay before executing your action, it should populate the variable. 

In HTML5, I've used this bit of Javascript to unfocus fields:

document.activeElement.blur();

Joseph Suarez

Storyline 3. It's not a fill-in-the-blank question type or anything. Just a plain content slide where I'm handling the "submit" actions manually. Buttons worked fine. It was just when a key press fired the same actions before focus changed. Adding the trigger with Javascript as the first action when key is pressed fixed it.