Friday, April 8, 2011

Simple autosave for Spring MVC form

I have one page form done with Spring MVC. User has to register first and I would like the form to be saved automatically so user can come later to finalize it. Traditional form submission with a timer is not what I'm looking for. Instead, I am planning to use some ajaxy way to send fields to the server at each onFocus event.

Any suggestions for implementations or comments for this approach?

From stackoverflow
  • I just recently did the same thing. I used JQuery and used their "serialize" function along with their "ajax" function to do the form submission. In my case, rather than use an event-driven approach, I simply saved the serialized form to a variable and checked once a minute to see if a newly serialized form was different from the previously saved one.

  • you also can check XT Ajax framework

  • I solved this using http://docs.jquery.com/Ajax/serialize as JacobM suggested. The serialized form is then sent as ajax post triggered by a timer.

    In Spring MVC I created a very basic controller extending AbstractController and extracted my fields from request.

0 comments:

Post a Comment