In the Project Storage and Models Storage when adding a storage variable I can set the type to Boolean.
When setting a storage variable in an Event (on Design page) or in Data, it would be good if the "Value" field were a drop down with True and False as the selections. In fact, to be able to use them in Javascript as boolean this is essential.
For example, I have a storage variable named "loggedIn" designated as Boolean. In the Design Events I added a "Page show" Event with Action "Set storage variable" and I typed in "false" (without the quotes).
Then, in a following "Page show" Event I have Action "Run JavaScript" and my script is:
preif (Apperyio.storage.loggedIn.get()) {
alert('value of loggedIn '+Apperyio.storage.loggedIn.get());
}/pre
the alert says "value of loggedIn false" but there should not have been an alert at all.
A Boolean with a value of false should fail that "if" statement.
In fact, if I typed in "true" and have
preif (Apperyio.storage.loggedIn.get() === true) {/pre
the "if" is evaluated as false.
I find I have to use
preif (Apperyio.storage.loggedIn.get() === 'true') {
and
if (!Apperyio.storage.loggedIn.get() === 'true') {
or
if (Apperyio.storage.loggedIn.get() === 'false') {
/pre
That is not how boolean values are supposed to work.
Or, perhaps I should be typing in something other than "true" and "false" for the value of a boolean storage variable.