Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save option when user tries to navigate to other page

 
Singhna Saman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to look up the solution to this problem couldn't find any. Well I need to implement a feature that basically tracks when the user tries to navigate to another url. Supposing a user is at some page

http://localhost/myApp/page1.faces

and works on something and then goes to another link that points to

http://localhost/myApp/anotherPage1.faces

At this point i need to take control and check if any changes has been done to page1.faces and if so alert user to save the state before moving forward.
I am looking for any suggestions on how to carry this out using jsf1.2
 
sreejith sreedharan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you can do is :

Create a link in

call doUpdateCheck and check if page1.faces is updated or not on actionBean.

if updated reRender Div with some values that javascript can findOut on Update ,

and on afterUpdate -> call above callJs and check for update value true/false

if updated show warning.

This is one way to do this

 
Singhna Saman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I will work as per your suggestion. Just another quick concern - can we call JavaScript from phaselistener implementation ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic