Forum Discussion
How to remove an initial value (0) from a "Numeric Entry" field
Hello,
Can anyone know, how to remove an initial value i.e. 0 from a "Numeric Entry" field?
Thanks in advance....
- ravindrasinghCommunity Member
Yes, we can remove default value "0" from it.
I hope it will help you.
- JaipalNegiCommunity Member
Nice Ravindra,
Got it what I want.
Thank you very much.
- JenniferRitterCommunity Member
I ran into this after I'd already placed all of my numeric entry fields in a course. There is also a way to get the default "0"s to go away from existing numeric entry fields without having to "Delete" and then "Ctrl Z" them.
I think I may be re-stating manish's solution, but basically:
1) Double click the numeric entry field's trigger in the trigger panel to pull up the variable assignment pop up
2) Use the dropdown and change the field's variable to "unassigned"
3) Create a new Text variable, name it whatever you want, and leave the default value for it blank
4) Double click the entry field's trigger in the trigger panel again to go back to the variable assignment pop up
5) Assign the new Text variable to the numeric entry field
6) Unfortunately, you have to re-do whatever triggers you had in place that referenced the original Number variable. I also recommend going back into your project variables list and deleting the old (now unused) Number variables, to keep the project file tidy.
- MicheleMarti034Community Member
This actually worked for me. Thanks for breaking it down.
- ChrisLivermo779Community Member
update - for those that get into this position (see thread above); don't create text variables as you lose the calc functionality, instead i) create a new numeric field (beside the old one), ii) rename the default variable on it.... this way the numeric variables are maintained in the triggers and it's speedier to rework. If you replace with text fields you lose the values in the triggers when you rework it. This sounds confusing even as i type it.
Moral of the story; rename default numeric variables, don't create new (or zero becomes your new best friend)
Thanks for popping in to share your experience and solution Chris - you may save someone some time in the future.
- narrativeBarekeCommunity Member
Hi Ashley and thanks for your quick reply!
My question was about getting rid of the 0 value in Numeric entries: the method described above involved replacing the numeric variable with text variable. Ofcourse that work fine, but it takes out the ability to make calculations (which was the original purpose of the Numeric entry, wasn't it?)
Thanks, Ofer
- SnorrskiCommunity Member
Hi Ofer
I have a solution for you. On a slide before the one where your numeric entry is situated (could be the start page), you put an "execute javascript" trigger. The code you enter is as follows:
var player = GetPlayer();
//Establish an empty javascript variable
var empty = "";
//Set your Storyline Numeric variables equal to the empty js variable
player.SetVar("YOUR_NUMERIC_VARIABLE_NAME_1", empty);
player.SetVar("YOUR_NUMERIC_VARIABLE_NAME_2", empty);
player.SetVar("YOUR_NUMERIC_VARIABLE_NAME_3", empty);
player.SetVar("YOUR_NUMERIC_VARIABLE_NAME_...", empty);
And so on...This will clear your variables, when you execute the course. Storyline might not be able to handle empty numerical variables, but flash and html5 has no problem with that.
- narrativeBarekeCommunity Member
Thanks Snorre
I will surely try this one :)
Ofer
Thanks for clarifying here Ofer and my apologies for misunderstanding. These older threads I try to just deal with the question as written in the most recent reply as sometimes they don't connect.
Within Storyline are you using Storyline 1 or Storyline 2? Within Storyline 2, I know a few users shared that if they were renaming the variable it would update to Zero - so perhaps that is how you're seeing it as well? Also clicking inside the numeric entry to update the formatting has changed it to Zero before - so you'll want to ensure you're clicking the lines of the text box.
- SnorrskiCommunity Member
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.
- TracyParishSuper Hero
@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? :) - JoanneChenSuper Hero
I do not have a 0 shown in the numeric entry field when creating one whether in SL2 or SL360. But once I click "OK" in the variable editing pane, the initail variable number will show even though I do not make any edit. Here is the Peek video for the test.
- TreyMcNabb-f8dbCommunity Member
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!
- WarrenZimmer726Community Member
- WarrenZimmer726Community Member
OK, I looked at the latest solution via Mr. Rubin's link, and it didn't clear the text fields on focus like I was hoping. Still troubleshooting, thank you for the effort.
Hi Jyothi,
You could add a trigger for the start of the timeline to set the value of NumericEntry to (blank) and that would stop the 0 from appearing automatically.