It's actually even easier than that... just do a client-side redirect
after the request-event in order to render the view instead of
returning the view immediately. This can be done with a handy response
type supported by the ControlServlet (in the controller.xml file).
There can be side-effects to this, so be sure to test...
You can use things to ID each rendered form and protect the
submissions based on that, but it can be quite error-prone depending
on how implemented, and for anything other than sensitive forms it is
usually not necessary. However, we could certainly implement something
like that, and using the form widget and the service event handler to
help we could make it pretty generic (ie implement once and apply
everywhere)... for FTL files and other event handlers it would require
changes for each form to support it.
-David
On Jan 20, 2009, at 1:25 AM, Bilgin Ibryam wrote:
Here is a discussion for using Synchronizer token pattern to solve it:
http://ofbiz.markmail.org/search/?q=prevent+double
+submit#query:prevent%20double%20submit+page:1+mid:6ydr3b2jhauda7pq+state:results
Bilgin
On Jan 20, 2009, at 9:03 AM, Adrian Crum wrote:
On the other hand, there are limitations to GET that will not work
with most HTML forms - that's why POST is used instead.
-Adrian
--- On Mon, 1/19/09, Raj Saini <rajsa...@gmail.com> wrote:
From: Raj Saini <rajsa...@gmail.com>
Subject: Re: F5 ( refresh of browser ) causes another item to be
added to the cart
To: user@ofbiz.apache.org
Date: Monday, January 19, 2009, 7:25 PM
In HTTP protocol GET method is considered idempotent that is
multiple
calls to the same resource should result in the same
result. In Contrast
POST method is no idempotent and therefore if a URL with
POST method is
refreshed browsers will through a warning message.
Therefore, we should use GET method for the safe operations
such as
fetching a list of records based on input parameters and
POST for
transaction which can change the state of application for
example
inserting a record in database.
Thanks,
Raj
Adrian Crum wrote:
Most browsers have a warning popup window that tells
the user that a screen refresh will result in reposting
data. Maybe you could supplement that with a similar warning
on the web page itself.
-Adrian
--- On Mon, 1/19/09, Rees Watkins
<gat.of...@yahoo.co.uk> wrote:
From: Rees Watkins <gat.of...@yahoo.co.uk>
Subject: Re: F5 ( refresh of browser ) causes
another item to be added to the cart
To: user@ofbiz.apache.org
Date: Monday, January 19, 2009, 11:13 AM
Hi
I have customised ofbiz for the travel industry. I
do not
hold any
product. All product sold is reserved and booked
on a 3rd
party site.
Generally cancellation has heavy penalties. In the
even a
customer buys
an additional item by mistake one of the parties
will lose
50 - 100% on
a refund. I would like to customise my ofbiz to
prevent
items been
added on refresh. Does anyone have any suggestion
or
comments on how
best to do this?
Thanks
Rees