Hi,
We are encountering occasions where users post twice or more a form, basically we have detected two situations: a) The user push twice enter b) The user push double click on button "save" or "submit"
We consider that this becomes a problem when creating (because we duplicate data) and we think that in some context it could become a security issue (like posting twice a payment), so we like to know How do you approach it?
Our approaches to the problem: a) JavaScript implementation like "<form onSubmit="doublePostCheck()"> and only returning true the first time -> Problems: different navigators (firefox, safari....), b) Token / Flag validation, base on a hidden variable in the form, and validation of a unique token/server for post in the server -> Problems: how do you handle errors... do you save the first register and raise and error for the second? -> Where should we implemented in the controller "create"? Can it be in the class ApplicationController? c) Hash of the data in the post, and checking if last hash is different than the new one -> Problems: how do you handle errors... do you save the first register and raise and error for the second? We can't duplicate data if we need it -> Where should we implemented in the controller "create"? Can it be in the class ApplicationController?
Thanks in advanced