Variable Needed?
June 18, 2017 12:00 AM
I feel I'm a bit brain dead as I have the nieces and nephews visiting for the summer (happy Father's Day to all the fathers & father-figures reading this). I have 4 buttons and when they click on them it will display the term, but there is a "Click each button to display descriptions" prompt for each button and if they click them in order everything works great. But, if they click them out of order, then the prompt will show up on top the term. I'm thinking I need a variable, but can not think of how it would work at the moment...please help.
Thank you!
Discussion (2)
Whenever you need to force a user to complete multiple actions before they can progress you need a variable.
When the page loads set the variable to it's own value - that way if it is EMPTY or has a default value it will be populated as such. PLUS - if you return to the page and you have previously completed the required actions then the variable will reflect those previous actions.
Best bet is to set the variable ( when created ) to EMPTY - no value......
Next - when a required action is begun/completed ( i.e. a button has been clicked ) ADD a value to the variable, but add a LETTER - NOT a NUMBER. Let's say - when the button is clicked add "A" to the variable VALUE.
BUT make sure you ONLY add the "A" IF there is NO "A" already in the variable - or you'll be adding an A to the variable every time you click the button.
Add this logic to the rest of the button ( add B, C, D ) when clicked.
The check to make sure the user has completed the required actions by checking that the variable contains A,B,C & D before they can move ahead OR you then display the prompt. You could even notify the user of which actions haven't been completed based on the value of the variable itself.
Perfect! I was thinking something like that, but I'm not really "thinking' much {as Sesame Street plays in the background} of anything at the moment!
Discussions have been disabled for this post