Set a variable to zero via javascript, is not displayed

Dec 08, 2015

Hello Community,

I've built some quiz slides with multiple entry fields (questions). The user has the option of saving his/her progress to an external file. At the beginning of a slide the values from the savefile are restored into the slide entry fields (via getVar + setVar), overwriting the "null" default value of the variables.

If no entry was previously made, the slide entry field will be empty.

If an entry was made, the slide entry will correctly display the previously entered value.

However, if the previously made entry is a ZERO, it won't be displayed.

Since the correct answer to some of these entry fields is a zero, it would be great if someone could help me with this issue.

2 Replies
Sebastian M

It is not really complicated. At the beginning of the slide there is a trigger with the Javascript:

var player = GetPlayer(); GetVar("NumericEntry1"); GetVar("NumericEntry2"); etc.

Whenever a value changes, the value is saved with 

var player = GetPlayer(); SetVar("NumericEntry1"); SetVar("NumericEntry2"); etc.

However, the data is saved in the environment of our custom-made browser with extended functionality, since we decided against using ActiveX. We've built a function that generates a name within the file that enables unique identification of the variable. How you can save your data depends on the browser/environment one uses, so my files won't really help. As I've said, all the data is stored and loaded correctly. 

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