Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Verfiy/ Preview form data before submitting.

 
Karthik Muthukumaraswamy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I want to implement a functionality where a user is shown all the form data he recently entered before he decides to submit/edit it.

Something like this:
enter data -> preview -> submit/edit

ps: I am using JSP and struts.
Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything that transpires prior to submission must be done with JavaScript.
 
Joel Jorgensen
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two ways that I can think of that you would be able to do this. The first way, as Bear mentioned, would be to use JavaScript to validate the form data and rearrange the page to provide a preview of what the user would be submitting. Put a "preview" button on the form and have it call a JavaScript function to do the validation/rearrangement, and then provide Submit and Edit buttons which will either submit the page or return it to it's previous (editable!) form, respectively.

The other way to do it would involve sending it to the server, Struts would do the validation (the details of which elude me as yet) and return either success (in the form of a preview JSP which takes the values from the form and displays them the way they'll be submitted) or failure (probably the original form, with the erroneous parts somehow highlighted for easy repair). The preview page would also provide a button for the user to confirm/submit the data, and a button for the user to edit the data, and each would be mapped to their appropriate Struts Actions (though if you want more details on how to do it that way, the proper place for it would probably be the Struts forum).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic