Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

Load event on "NavigtionToPage".

Hello Team,

My question is a bit similar to this question, However I didn't get my answer from it.

https://getsatisfaction.com/apperyio/...

My question is -

If I have two pages -
Screen1 and Screen2. And my starting page of this app is "Screen1", and there is a button on this page to navigate to "Screen2".
On "Screen2", I have a button, and on its NavigateToPage event, I am returning to "Screen1", here "Screen1" load event doesn't call, so my values in input box and all will be there.

Now, I have three pages.. "StartScreen", "Screen1" and "Screen2".. And initial page is "StartScreen", and there is a button on this page to NavigaeToPage to "Screen1", and rest are same... But now if we are on "Screen2" (we came here from "Screen1") and button's NavigateToPage event, we come to "Screen1", but here page's "Load" event also call along with "PageShow" event.
Can you please explain it why???

I am sharing public link of app..

http://appery.io/app/mobile-frame?src...

And for testing.. When you come on "Screen1", then fill name in it, and click the button to reach "Screen2", then when you click button on "Screen2", why "load" event call, and "Name" text get blank..

Please help.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Load event on "NavigtionToPage".

Hi Himanshu,

Appery.io application always stores 2 pages: start screen and the current one.

If you navigate further, start screen remains, while the current is replaced with the new value.

If you then navigate to the previous one it will be loaded again (Load event fires).

Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

Load event on "NavigtionToPage".

Then what we can do to keep values on "Page1", when it loads with Back Button (Navigate To Page) on "Page2".

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

Load event on "NavigtionToPage".

Hello Himanshu,

You can save values from UI components to localStorage variables before navigation from your page and then on "load" event on this page restore them from localStorage variable to UI components

Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

Load event on "NavigtionToPage".

Hi Katya, Please give me any suggestion in this case.

My starting page is "LogIn page", and on this page I want to prevent the user to use device "Back" button, and if I write any code on this page, then it reflects to all of the pages on their "Back button", how to handle this?

Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

Load event on "NavigtionToPage".

Thanks Evgene, I managed to work with localStorage variables. But I had to call my web-service again on back button (NavigateToPage).

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Load event on "NavigtionToPage".

Hi Himanshu,

Why can't you use Page Show event? Do you want to invoke a service on the page you leave? You can add a Click event handler on Back button:pre$("role='button'").on("click", function(){
// any JS code you need
});/pre

Return to “Issues”