Forum Discussion
Numeric variables: Default of "zero" isn't treated as a number?
In SL3 I have a numeric entry box, assigned to the variable "NumericEntry". In "Manage Project Variables", the default value for NumericEntry is listed as zero. I want to prevent users from advancing without entering a value, so my "Continue" button has a trigger to display an error layer if NumericEntry = zero. However, Storyline isn't recognizing NumericEntry as a number until the user enters a value. As proof of this, when I put a text box with "%NumericEntry%" on the page and preview, the text box is blank. It should show a zero.
I can't cheat and use text entry, because I need to do calculations with this number later in the project. I also can't put a trigger on the slide to set the variable to zero when the timeline starts, because if I do that, SL3 auto-fills the numeric entry field with a zero instead of the text I chose, which is "(enter #)"; The instructor doesn't want the autofilled zero, because when students click in the box the cursor appears after the zero, leading to a high likelihood that users will begin their entry with zero (e.g. "0100" instead of "100"). This also breaks calculations later.
It seems that if SL3 is telling me the default value is zero, then it should be the number zero, and be usable in calculations.
Is this a glitch, or am I missing something?
24 Replies
- WendyWilliams-8Community Member
While we are at it :). You said we can use the answer/variable in another calculation. I actually have need on another screen where we have a java script that fills in a blank, then I need that event to trigger auto-filling another field. Is there a tutorial or something that would help me with the scripting required to make something like that happen? THANKS!!
- MariaCSStaff
Hi, Wendy.
Will changing to a text box solve the issue where '0' is the answer? We need to be able to use the '0' as the actual answer.
Yes, a text variable will accept 0 as the answer (correct or incorrect), so that's a good workaround for that.
Is there a tutorial or something that would help me with the scripting required to make something like that happen?
We don't offer support in Javascript, but I'm hoping others in the community will be able to provide you with guidance!
Related Content
- 10 months ago
- 10 months ago
- 10 months ago
- 10 months ago
- 10 months ago