How to remove an initial value (0) from a "Numeric Entry" field

Apr 09, 2014

Hello,

Can anyone know, how to remove an initial value i.e. 0 from a "Numeric Entry" field?

Thanks in advance....

74 Replies
Snorre Rubin

I have created a (rather complex) work-around, which I think works really well.

Try it out here:

http://elearning.hosp.dk/0Afproevning/SNORRESLEGEPLAD/story_html5.html

I have also attached the story file if you want to copy it.

Instead of actual numeric entry fields, it uses javascript triggered by keypress, and a couple of variables.

Numerical: "currentValue"
Text: "currentValueText"
If you have more than one input field: "currentVar"
The text variables seen in the slide: "a", "b", ...

If there are more than one "field" I use layers for each. 

In this case, layer "a" opens when timeline starts, and sets "currentVar" to "a". I use that variable to tell the storyline which variable needs to be updated.

Now in a master template, I have made a number of keystroke triggers, with a javascript function in each. E.g. if you press "1" this scripts is triggered:

var player = GetPlayer();
var val = player.GetVar("currentValue");
val = player.GetVar("currentValueText");
val = val*10+1;
player.SetVar("currentValueText", val);
player.SetVar("currentValue", val);

This will add a "1" to the number in both the "currentValue" number variable, and the "currentValueText" text variable. The same happens if you press "NUM1". For each of the other number and numerical keyboad keys, a similar script is triggered, just with "val*10+2", "val*10+3", etc.

Now if you press "DEL" another script is triggered:

var player = GetPlayer();
var num= player.GetVar("currentValue");
var div= "10";
var dec= num / div;
var res= parseInt(dec);
player.SetVar("currentValue", res);
if (res == 0) {
res = "";
};
player.SetVar("currentValueText", res);
console.log("dec: " + dec);
console.log("res: " + res);

Which shaves the last digit off the number.

 

Tracy Parish

@Wendy

I see the same thing in SL360, the number variable entries appear with a 0.  The only thing is when you go to enter in a number (eg. 205) the entry now appears as 0205.  That zero does not disappear when you enter in your number (it just stays at the beginning).  As a user (entering in the number) if I delete the 0 before typing in my number the entry box now displays the "Hint text" and if I enter my number all looks the way I wish it did from the very beginning.

I'm a bit stunned there are so many complex issues/fixes to address this problem.  Why don't they just function/appear like text variable inputs?   :)

Shannon Trine

I'm having the same issues and I've tried all of the above. The javascript doesn't appear to work for me, it gives the NaN message.

The strangest thing is slide 1 shows the "0" and slide 2 which has the same numeric entry type shows blank. I've been having a hard time trying to figure out what happened and why they are different on each slide.

Any insights?

Stefan K.

Hi Snorre,

I tried your solution. When I click on the rectangle, it disappears, but the 0 is still displayed..... It's a bit frustrating because I can't find a working solution to the problem with the initial zeros...

 

I have 50 numeric entry field in my WBT... I need a simple and easy solution..Why can not Articulate fix this old issue?

Ashley Terwilliger-Pollard

Hi Stefan,

Have you renamed the numeric entry variable? Our team is looking into an issue where that causes the 0 to display after it's been renamed. It should be blank to start. 

If that matches what you're seeing, I'll include this discussion in the report our team is investigating so that I can keep you posted here. 

Jennifer Shafley

I am having a similar issue. I have two specific issues I am trying to solve: 1) I don't want the zeros to appear (I have not renamed the variables) and 2) I want these typed numeric values to reset when a user clicks a button. I have attached a file with my current efforts. You will see that I have added triggers to reset these values and I have tried adding a duplicate slide so that you go back and forth in an attempt to trigger the reset when revisit. None of these have worked for me. I'd like to avoid javascript fix if possible.

Ashley Terwilliger-Pollard

Hi Jennifer,

Thanks for sharing your file.

First, I noticed you had some conflicting triggers to reset the slides. It was set to jump to slide 1.1 and 1.2 - and therefore both triggers weren't executing leaving the user stuck on slide 1.1: 

I was able to remove the trigger for Slide 1.1 on that slide, and the same for Slide 1.2 and then it started to work normally.

I also saw the reset would only occur on the first jump to the new slide. One thought is you could add a trigger to set the value to 0 when the timeline starts, and that'll reset it each time you visit the slide.

Also, the 0 appears when you change the trigger from Set NumericEntry10 equal to the typed value when the control loses focus to Set CreamValue equal to the typed value when the Control loses focus. That's where the variable name has been adjusted and what you'll want to look at not changing.

I made these changes (to the jump to slide triggers and the variable reset only on SugVal entry) on the attached file for you to take a look at!

Alyssa Gomez

Hi Jennifer!

There seem to be two different issues going on here, so let's tackle them one at a time:

  1. The initial value of the text entry field is 0 and not blank: This is happening because there is a bug in Storyline 360 where when you rename a numeric variable, the entry field and the variable reference display a 0 instead of the default blank. 

    For example, in your file, the variable NumericEntry was renamed to SugVal. Now that the variable has been renamed, the default value will display as a 0. 

    Our team is looking into this bug, and we'll let you know as soon as it is resolved.
  2. The slide would not reset back to its initial state: This was happening because you were mixing your variable references. In the trigger panel, I saw the first numeric entry referenced as NumericEntry and as SugVal in another instance. 

    To fix this, I made sure all of the variable references were consistent using the new names, like SugVal

In this updated file, you'll see that the numeric entry fields now reset to 0 when you click the Reset button. Please take a look, and let me know if it's working for you!

Trey McNabb

Thanks for the video Joanne! This helped me with the workaround.

If you DON'T double click the name in the variable list, single click to change the name, then it stays blank. This also allows you to add an instruction like 'Add Q1 number here' in the box. It's only when you enter the variable assignment screen that pesky '0' shows. (I'm on SL3, but same result).

@Ashley - thanks for letting us know Articulate is working on fixing this!

Bones Hewitt

Trey's observation set me to thinking as I too was battling with this problem. The issues were further complicated in that I am using multiple variables for each entry. In this way giving the user the option to change an entry which then corrects a total by removing the incorrect value.
The solution I used to eliminate the zero in the entry field was to fully complete the build of the slide (especially variable triggers) concerned and then to duplicate the slide. The effect is that the new slide creates fresh variables which no longer reflect a zero in the entry field.
Delete the original slide and then delete all unattached variables.
To be fair this only applies for the initial interaction, subsequent interactions and resets within the session will again display a zero. 

Ashley Terwilliger-Pollard

Hi All, 

A quick update to let you know we've released a fix for this issue where Numeric-entry fields displayed default values of zero after renaming their underlying variables. They should remain blank until learners enter values. You'll find that fix available in the latest update Storyline 360, build 3.28.18944.0

To install the update, launch the Articulate 360 desktop app on your computer and click the Update button for Storyline - you'll find more details here.

Please let us know if you have any questions, either here or by reaching out to our Support Engineers directly.