Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Condition on local variable

I am trying to run a javascript if statement on local variable that is set with a query response when the app is first started or when the user logs in. The javascript console is giving me an error stating that the variable is not defined. Not sure what needs to be done to fix this.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Condition on local variable

You need to share the script and the exact error you are getting.

Michael Pierce5821971
Posts: 0
Joined: Fri May 03, 2013 11:29 pm

Condition on local variable

if(dontShowHowTo == 'true'){
}else{
Appery.navigateTo('howToPopup', {transition: 'pop'});
}

The error on the console is "dontShowHowTo is not defined". However, when I look at the local resources it is defined with a value of 'false' that it is getting from a Get_User query response.

Essentially, I am trying to have a popup display how to play a game if it is someone's first time and then they have the option of checking a box to not display again which would update the database column to 'true' if selected. Then when the game screen is displayed again it is running this if statement on load to get the value of the local variable; if it is now true the popup shouldn't display and the user can go right into the game.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Condition on local variable

Hello! If dontShowHowTo is a localStorage variable then code should be the following:

codeif(localStorage.getItem('dontShowHowTo') == 'true'){
}else{
Appery.navigateTo('howToPopup', {transition: 'pop'});
}/code

Return to “Issues”