0

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

Mayank Tiwari
  • 83
  • 1
  • 2
  • 11
  • Please share some code :) – Kelly J Andrews Jan 11 '14 at 12:29
  • I haven't seen any application that allows you to cancel a persisting action in the middle of transaction. The whole purpose of having an edit view is to change data, so why allow to cancel it? What makes the processing so slow at first place? Disabling save button doesn't make anything more safe. – Vaelyr Jan 11 '14 at 12:43
  • Thanks Kelly, your comments makes sense, now I am not going to proivide cancle action, while doing database transaction. But what if user click Save button multiple times in between transaction. Should I disable the save button after one click or I should show a page shoing :"Please wait message". Actully I dont want to show "Please wait page". So how to handel muliple save request. For me disabling save button making sense. If you have any better suggestion. Please share. Thanks – Mayank Tiwari Jan 11 '14 at 13:10
  • Kelly J Andrews: Currently I am writting Low Level Desing. So dont have any code :-) – Mayank Tiwari Jan 11 '14 at 13:22

1 Answers1

1

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)
Ralph
  • 118,862
  • 56
  • 287
  • 383
  • Ralph: Thank you so much for providing solution. I will do both server and client side validation. In case javascripr is desabled at user end, I can handle using server side. Thanks alot – Mayank Tiwari Jan 11 '14 at 13:33