Creating a trigger condition that advance after 4 numbers entered

I am working on a project right now where I prompt the user to enter a sort of verification question, in this case I am asking for the last 4 digits of their SSN. They will then be prompted later to enter them again (using this method here: http://community.articulate.com/forums/p/31893/172296.aspx#172296 to "verify")

I have made a text variable and a submit button. However, I would like the user to only be able to click submit then jump to the next slide if they have entered 4 digits into the text variable field. I can't seem to figure it out within the trigger conditions option. Any ideas?

12 Replies
Ashley Terwilliger

Hi Hannah,

From the thread you linked, it looks like Mike had created a custom submit button with a condition to check the text entry field for the appropriate information before moving forward (or in his case show an Imposter layer). Without seeing how you have your triggers set up, it's hard to know why it's not working, but you'll want to double check trigger order (from top to bottom in the trigger panel), as that'll determine how Storyline interprets each trigger to determine what to do next. 

hannah h

i have figured out what i want to happen, i want the user to have to enter 4 digits into the numeric entry field and the condition for the submit button would be only if the number in the box was greater than 1000 and less than 9999. i am viewing one file that was sent to me where this is accomplished, however when i pull up the "add trigger condition" box, there is no option for that in the operator menu. however in the other file it is in the operator menu. if i copy and paste the trigger from the other file, my numeric entry field shows up as "unassigned" and it won't let me choose my variable to replace "unassigned." 

hannah h

i figured it out but the fix was confusing to me as an articulate tutorial led me to believe that naming the numeric entry box as a variable was the thing to do. and then when applying conditions to it to select the variable. i had to choose "numericentry" from the "if" list instead of the name i had given the variable. 

Jerson  Campos

Question,  what if the users last 4 numbers started with 0?  (0482)?  Don't mean to throw a wrench into this.  I was actually working on a fix for this.  What I plan on doing is creating a javascript that would be executed and check if the character length equal 4, if it is then it would move forward, if it isn't then it would display a warning message. 

Jerson  Campos

Attached is the storyline file that should meet your needs.  It executes some javascript (borrowed from Phil's tweet example), checks to see if the SSN entry is 4 characters long and than shows the appropriate screen if it is correct or wrong.  You will have to publish it to a web server to test it because of the javascript.

An issue  I ran into. I couldn't make the text entry box a numeric entry box.  The javascript wouldn't work for me when I did that, so I just made it into a text entry field.

Here is a demo

Phil Mayor

Nice demo, you may be able to do this without JavaScript.

you could set a a T/F variable when to true when you click a text entry field, and to false when the control loses focus, then set triggers to add one to a numerical variable when you type the numbers and delete 1 if you hit backspace as long as the T/F variable is == true. 

Should work as as long as they don't use letters. 

Javascript is is likely the best way to go as it will be more accurate. 

Jerson  Campos

Thats why I used a text entry box,  Storyline automatically strips away the 0 if it is the first number.  So 0123 would be saved as 123, and when it gets processed by the javascript it would be invalid because it is looking for 4 numbers.

Phil,

I'm sure there is some bit of code to check if the data entered are numbers, would you happen to know how?