• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving the form before navigating to some other page

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts framework.

I have page1, page2, etc.
On page1 there is a link to navigate to page2. Also there is a form on page1 that user fills in and submits. If user enters details on this form and clicks on the page2 link without submitting the form I would like to prompt the user whether he wants to save or not. If user says yes, I need to save the form and stay in the same page. If user says no, I need to proceed to next page without saving it. I want to do this action in the web-tier.

Thanks!

 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rohithaksha Kalluraya wrote:If user says yes, I need to save the form


What do you mean by save the form?? You can use a javascript confirm dialog to prompt the users choice of yes or no. This confirm dialog can be shown on the onclick event of the hyperlink. If the user chooses to navigate to the other page, you'll return true from javascript. If user wants to stay at the page, then you'll return false from the javascript, when the onclick event of a hyperlink returns false, the browser doesn't follows the hyperlink...
 
Rohithaksha Kalluraya
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You for the reply!

Let me rephrase the question. I have a page "page1", that page has a form (where user can enter details, ex., account creation form). I don't want to do a frontend validation using javascript, but would like to use MVC framework that validates and remembers the user input even if the user does not submit that form. Closest example of this I can think of is, gmail that keeps saving the composed emails. Even if user loses connections or forgets to send the email, that email will be saved and can be retrieved from Drafts folder.

Thanks again!
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What gmail does is that it keeps making ajax requests at regular time intervals and sends all the form data (the email in case of gmail) to a specific servlet/struts action on the server which saves the values somewhere (in drafts folder in case of gmail). That's what you need to implement too. The exact implementation details will depend on your requirements...
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic