Question

I have a question regarding save and calcel button. I have one Editable screen where user can perform 2 action: Save/Cancel

Suppose user clicked the save button which is going to update details in database. This processing takes time. So in between user may click Cancel button. I that case, I have to abort updating database and roll back the all database changes and display previous details.

I have one more question, user may click save button for multiple time. So i was thing to disable save button after one click and let processing complete then only enable it.How it is possile.

I am looking for answer in Java/Spring MVC prospective.

Thanks Mayank

Was it helpful?

Solution

Let me summarize your problem first: "You have a form, and you want to make sure that a user can submit the form only once". - right?

  • Client Side Solution: use some java script that disable the buttons after the first is clicked

or:

  • Server Side Solution: use some token (number) that is delivered with the form, and returned to the server when the user submits the form (hidden field). The Server then needs to check that a request with a token is only accepted once (a second request with the same token will must been rejected)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top