Forum Discussion
jma64
25 days agoCommunity Member
Enter not advancing Text Entry slide after correct text
I am not able to get my slide to advance after entering the correct text and then pressing the enter key. It does nothing. If can advance with the tab key but this is not the functionality I want t...
Phil_Wingfield
24 days agoCommunity Member
Storyline input fields only update the variable after the field loses focus, not when something is actually typed (which can be very confusing). Tab works because it moves the user's cursor to the next object, so the field loses focus, the same way it would if you were filling out a form and pressed tab. Enter doesn't always work because it is a viable entry in a text field to start a new paragraph (you may find success adjusting the height of the box to be shorter).
Try using JavaScript to update the variable when enter is pressed by setting this script to run when the timeline begins:
const player = GetPlayer();
let input = document.querySelector('.input');
$(".input").on('keyup', function (e) {
if (e.key === 'Enter') { //when enter key is pressed
player.SetVar("SimulationTextVariable", input.value); //the value for SimulationTextVariable is set to update to the current input
}
});
Related Content
- 5 months ago
- 3 months ago