R2R
Posts: 0
Joined: Wed May 07, 2014 7:24 pm

Appery.navigateTo( ); based on local variable value

This really seems too simple, and I can't get it to work. I have two pages (page1 and page2). I have the following actions:

On page 1:
(1) page1 - page show - set local variable locPage (its not bound to a component and the value is set to "page1")

(2) btnFeedback - onClick - Navigate to page - Feedback

On page 2:
(1) page2 - page show - set local variable locPage (its not bound to a component and the value is set to "page2")

(2) btnFeedback - onClick - Navigate to page - Feedback

On the Feedback page, I click a button (btnCancel) to return to either page1 or page2 depending on what the value of locPage is. I have the following action on btnCancel:

btnCancel - onClick - Run javascript (see code below)

Image

Using the browser debug tools/console, I see that the variable changes value as it should in the console based on the page I'm on, but btnCancel always returns to page1, even if I access page Feedback from page2.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Appery.navigateTo( ); based on local variable value

Hello,

You should get value of local storage variable with this code:

codelocalStorage.getItem("locPage"); /code

R2R
Posts: 0
Joined: Wed May 07, 2014 7:24 pm

Appery.navigateTo( ); based on local variable value

Ok, but I don't understand where to enter this code? Does this line of code go before the code I have entered above? Does it replace some code? Where do I add this code and what does it do?

R2R
Posts: 0
Joined: Wed May 07, 2014 7:24 pm

Appery.navigateTo( ); based on local variable value

Using trial-and-error with the line of code you provided, the following worked:

Image

Thank you Evgene!

Return to “Issues”