Forum Discussion
Storyline "Set (variable) equal to the typed value When TextEntry1 loses focus" - is there another way?
I have a slide where I want the user to type into TWO text entries before it allows a button to be pressed. I have a slide with the two entries and a button, and have defined two text variables 'text1' and 'text2'.
Adding a text entry field automatically adds the 'Set text1 equal to the typed value When TextEntry1 loses focus' trigger for each.
I have the button set so that its default state is 'disabled', and triggers on both text entry fields to say
'Set the state of Button 1 to Normal When user clicks outside TextEntry1, If text1 != value blank AND text2 != value blank'
This works about half the time. Some testers have mentioned that even though they have added text into both fields then clicked on the button, it remains disabled. (clicking the button is natural for people to assume, plus it should mean the focus is lost from the field, therefore the variable should be set and button state trigger recalculate).
Sometimes it takes two or three clicks of the button. Others have reported the need to click back INTO the text entry then click out of it again in order to be able to click on the button. The behaviour is inconsistent.
Ideally I'd like to be able to set the variable to the typed value based on any keypress, but that doesn't seem possible without resorting to javascript.
Can anyone suggest a way to achieve the same without the variables?
- MathNotermans-9Community Member
i tend to distrust the button behaviour in Storyline and thus not use 'disabled' state. Instead i add a shape that is almost invisible to block the button. That i can control and hide when my conditions are true and i want the user to be able to click ( when inputfields are filled ).
- NedimCommunity Member
I can confirm described behavior after following your basic slide set up. I don't think you can resolve this without variables as you need them to compare, verify or validate if something is true or not. Maybe you should consider JavaScript solution to your issue. Anyway, here is my take on this. I created two triggers as shown in the screenshot. Condition statement ELSE in SL is a bit underrated but I found it a quite useable in many projects. Below is a link that you can play with. There is also a some sort of textual indicator to show the state of the button. You may go back and erase values in one or both text fields and the state of the button will update (will not be clickable) once focus is lost or retype in both fields to enable the button.
https://360.articulate.com/review/content/0ea7a8ff-ec9d-4b8c-afb8-3c05ac0f041f/review - Tim_Community Member
Ok looks like a combination of these will work. I'm also finding the disabled state hasn't always switched to normal (fixed by the hidden layer blocking the ability to use that button) and the use of 'else' to ensure it switches back to the default state.
- WaltHamiltonSuper Hero
Math is right, I would use his method.
I would hide the shape using these triggers:
Change state of shape to Hidden when text1 changes if text1. != value blank and text2 != value blank. And one like it for text2.
Using “when variable changes” avoids any the problems associated with when and where the learner clicks. If, and only if, and always if they actually change the variable does the trigger fire.
- NedimCommunity Member
I personally use the disabled state, a lot. Not because I'm mad about it but my client wants to see it. There are potential issues and we have to find a workaround. And workaround takes time. If something ain't right, Articulate should fix it. This should be a simple task but what is make it more complicated is that TextEntry in SL sets a value only after it losses the focus although, technically, there should already be some value as soon as we start typing, it's just not set yet In SL. Therefore, in this scenario, I would use a few lines of JavaScript, one boolean variable in SL, and one trigger (no TextEntry SL variables in triggers), to handle the state of the button no matter if I have 2 or 20 text entry fields or even more buttons . And one variable is pretty much all I need to change the state of any element in the slide. The code is simple and it's like ""if all inputs have some value (not blank), turn all on, if not (at least one), turn all off.
https://360.articulate.com/review/content/0ea7a8ff-ec9d-4b8c-afb8-3c05ac0f041f/review