Forum Discussion
Disable next button until user enters text into all text entry fields on slide
Hello- I have been successful in disabling the player next button in drag and drop situations and in counter situations but I cannot figure out how to disable the next button until the user has entered text in several text boxes on the slide.
Thanks in advance!
- GregFaustCommunity Member
My inclination would be not to disable the "Next" button, but rather to attach a conditions. If you select your text entry box in the editor, you'll see (in the triggers list) that by default it dumps the student's entry into a text variable. So one trigger would be:
Jump to slide
next slide
when User clicks
Next button
[show conditions]
TextEntry1 Not equal to [default]
AND TextEntry2 Not equal to [default]
AND TextEntry3 Not equal to [default]This gets at the heart of what you REALLY want: The text entry variables must be populated with something other than their default values. If the user has not typed something into each box, the Next button won't take them to the next page.
Then you'll want a trigger to display an error message if the user HASN'T filled in all the boxes. Make a new layer and call it "Error Message". Put a big friendly text box into it that says, "You must enter all the text fields to continue". Also add a button that says "Okay!" and has a "Hide this layer when user clicks this button" trigger.
Now you need this error layer to come up at the appropriate time. Copy that first trigger on the "Next" button, and in the conditions, change the "ANDs" to "ORs" and the "Not equal tos" to "Equal tos". Also change the trigger so it shows the message:
Show Layer
Error Message
when User clicks
Next button
[show conditions]
TextEntry1 Equal to [default]
OR TextEntry2 Equal to [default]
OR TextEntry3 Equal to [default]
I don't know for sure whether Storyline can handle empty space for the [default] variable value, so you'll have to play around a little.- MarcellaSimonCommunity Member
Thanks Greg! I understand the logic but I am stuck on setting the default
for the variable since they don't seem to have them specified in the
variable list. - JimDougherty-4aCommunity Member
Greg -
Not sure if you are still around, as this post is 3 years old. However, this helped tremendously! I'm new to variables and am really starting to love their power! Thank you for sharing, my friend.
- WendyFarmerSuper Hero
Hi Sarah
can you see that each of the text entry fields are validating correctly?
Might be easier if you upload the slide for someone to help if they can work with your setup
Update: I did a sample based on your image with triggers and its working for me unless I misunderstand what you are doing
- SarahBurgartCommunity Member
Wendy, with your upload, it shows the layer even if I don't enter anything into the fields - which I don't want. I don't care what they put into the fields, but I want the learner to be unable to proceed until they enter something in each field.
I will work on figuring out how to upload the slide itself.
I also noticed you didn't set a default value for the text boxes - I couldn't figure out how to use them without doing that ...
- WendyFarmerSuper Hero
Hi Sarah my sample was done blind by just looking at the image you supplied with no other information. Glad you got it sorted out.
- MichaelHinzeCommunity Member
You could set up triggers with conditions that only enable the Next button when none of the textentry boxes is blank.
- GregFaustCommunity Member
Margaret, check the conditions on the second trigger on your Next button. It's showing for me that the fourth condition is "OR TextEntry4 != Not equal to (blank)". I believe it should be "OrTextEntry4 == Equal to (blank)", like the other three conditions.
- MichaelLaudoneCommunity Member
Hi Marcella,
Again, variables are going to help you.
- Set up a variable, e.g., clickInBox of Number type.
- Set up a trigger on your text box. so that when the learner clicks into the textbox, have the variable update.
- On the next button,
- change the state to hidden
- add a trigger so that it changes states when the variable changes to a certain number (a add a condition) so that is runs when the variable reaches a certain number.
There may need to be some error captures but it should work.
- MarcellaSimonCommunity Member
Thanks Michael! That way had worked with drag and drop but when I tried it
with text entry, it did not work. I must be doing something wrong.I set up a variable FillBox with an initial number at 0.
I then set it up to change to 1 when user clicked the text entry box.
I had disabled the next button (upon timeline starting) and then made it
normal when the count reached 1
- GregFaustCommunity Member
What object is the "Change State of Next Button To State Normal..." trigger attached to? In other words, is the trigger listed under "Player Triggers", a layer name, or some other slide object?
In my experience, triggers can fail to activate when they're attached to an object that doesn't want to activate triggers. Specifically, I've had to change my triggering event such that a trigger would NOT be attached to a hidden object. I wouldn't be surprised to learn that Disabled objects present a similar problem.
- MarcellaSimonCommunity Member
Thanks Greg!
I am not sure I understand completely but disabling and then normalizing the
next button worked with conditions like drag and drop or clicking on shapes.
It does not seem to work with text entry boxes. So I may not be setting up
the variable correctly.
- MichaelLaudoneCommunity Member
Sorry, Marcella! I didn't actually test this I just gave you the steps at I understoond.
THERE IS ANOTHER BUG in this software. For some reason, when you adjust the variable it is returning a non-numeric value (even though the logic clearly says to adjust the variable to a numeric value).
There's a convoluted way around this...as I've found with this application...instead of changing the value of FillBox when user clicks in the TEB, create another variable (ClickedInBoxTF) that is boolean set to false but changed to true when the user clicks in the box. NOW, change FillBox to a value based on the ClickedInBoxTF == True. Tested this and it worked but way too cluggy.
- MarcellaSimonCommunity Member
Thanks again Michael!
I set up the FillBlank variable to set out as false and change to true when
the user clicked the text box. Then enabled the next button if the variable
is true. It worked! - MarcellaSimonCommunity Member
I seem to be able to make it work for one text entry but not for multiple on
the page.
Hi Marcella,
It looks like Greg has you covered here, and text entry boxes automatically create variables, and their default is set to empty as a built in functionality, so I'm not sure what element you're having difficulty with? You may want to post what you've got set up so far in terms of triggers and variables, as that way we can take a look at what you've set up.
- MarcellaSimonCommunity Member
Thanks Ashley!
I guess my difficulty lies in setting up the trigger conditions for the "not
equals" default for the text box variables. If the variable for the text box
is TextEntry would the statement read:Jump to next slide when user clicks on next button
Condition:
TextEntry is not equal to value default?
- GregFaustCommunity Member
Replace the word "default" with whatever you have set as TextEntry's default value. You can view and edit default values in the variable manager (see image).
Also, if you're planning to use these variables later in your course, you may want to give them more descriptive names. For example, "StudentFirstName" or "FavoriteAnimal" (or whatever information you're asking them to enter).
Also also, be aware that you can display these variable values with %[variable name]%. For example, say the variable StudentFirstName is set to Steve. A text box that in the editor that says "Your name is %StudentFirstName%." will publish as "Your name is Steve.". This is great for debugging and for giving feedback to the learner.
That should work as well Marcella. Have you tested to see if this performs as you expect? Without seeing your file, it's difficult to understand, but Greg has explained it well.
- MarcellaSimonCommunity Member
Thanks Leslie! I am still playing around with this and everyone has been
very helpful. My problem is still with the automatic default for text
boxes. I have put in examples of sentences in the text boxes to be
overwritten which is messing up putting in values like numbers or
true/false.