Problem with Removing zero from Numeric Entry in Sl3

May 29, 2018

When I try to remove zero in sl3, display  NAN  While I run this code without any problems in Sl2

I used this code in sl2:

var player = GetPlayer();
var empty = "";
player.SetVar("Q1", empty);
player.SetVar("Q2", empty);
player.SetVar("Q3", empty);
player.SetVar("Q4", empty);

23 Replies
Ashley Terwilliger-Pollard

Hi Smko, 

The changes that were made to the publishing engine for Storyline 3 and Storyline 360 impacted some of these customizations with Javascript triggers so that if they worked in SL2, they may no longer work. I also took a look at the Numeric entry and noted that since it's happening for numeric variables created for numeric text entry boxes, this is by design. The variable is initialized to be "not a number", i.e. NaN, so that no number will show up in the numeric entry field, until the user types one in. 

Hope that helps clarify, and let us know if you need anything else!

Beth Case

I can't believe this is still a problem. How often do you want a zero in a numerical entry box that a user has to delete in order to type in their number? And to have to keep the name given automatically which is very confusing if you have very many variables. This was a problem 3 years ago and is still a problem. Please make it possible to set a numerical variable to empty like you can a text variable!

Heather Vogt

I just added a Numeric Entry to my slide and didn't rename it; I still get a 0 when I preview.

The slide this numeric entry is on is part of a question bank (if that matters). Also, the numeric entry was tweaked so that what a learner types is what's captured when the control loses focus; this, obviously, isn't a default setting.

If I'm understanding this correctly, you have to keep *everything* default if you want to use a numeric entry that doesn't show 0. Is that what you're saying?

Alyssa Gomez

Hi Heather,

Yes, you're right. You'll also want to keep the default numeric entry trigger: Set NumericEntry equal to the typed value when the control loses focus. 

Changing the variable in that trigger will cause the 0 to incorrectly appear in the numeric entry field. 

As a workaround for now, try adding the trigger below. I made that change in your file and attached it here. Let me know if that workaround would be an option for you!

Tracy Windsor

Thanks for the reply -- I got a work around by using 'text' instead of numeric. Then assigned the text variable to a numeric variable so I could add as needed.

BUT do you have any suggestions on the second part of my question? I also need the entries to be 1 - 4 where is number can only be used once -- basically we're rating the options on the screen between 1 and 4 -- any help would be greatly appreciated.  Thanks!

Tracy Windsor

Beth -- I figured it out but it takes a lot of work.

In my case I have 4 choices, so each one had to have the following Tigger

Action: Show Layer
Layer: Try Again
When: Variable Changes
Variable: FLA1
On Condition:
FLA == Equal to 1
AND SCWA1 == Equal to 1

I repeated this 4 times, Where the Equal to 1 changes, to 2, 3 and 4.

Then I had to repeat for each of the 4 Input variables on the screen. -- Hope this makes sense. I've attached one page of my course so you could see.
 There are a lot of triggers on this slide, brief description for each below

Change State: Disable Next button
Change State (visited): Normal Next Button (Had to do this two different ways, the second way is for when I revisit the slide I wanted the Next button active (not equal to blank).)
Set Variable:  Text Variable to a number variable so I could add.
Show Layer (Invalid Input): Must be a number between 1 and 4.  
Show Layer (Try Again): Number 1-4 used more than once

I need to add a reset variable in there somewhere -- now since it only works the first time I enter a number -- back to the drawing board, but this should help you somewhat. (I may have lied, maybe it was confused, but it appears to be working now.) -- :)

There may be an easier way to do all of these, but I'm just starting out....


Crystal Horn

Yes, variables can be adjusted with drag-and-drop interactions. I'm attaching a sample file with 4 choices to rank. Because there are 4 possible rankings, I'll have 16 triggers. This means you'll still have your 225 triggers issue to make sure that you can account for all possible rankings of each item. Here's a demo of what I set up.

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. 

Lauren Connelly

Hi everyone!

Today we released the Update 7 for Storyline 3! (Build 3.7.20003.0) 🎉 

Update 7 includes the fix to the issue where numeric-entry fields displayed default values of zero after renaming their underlying variables. In this update, the numeric- entry fields will remain blank until learners enter values!

This discussion is closed. You can start a new discussion or contact Articulate Support.