[Catalyst] The old double-post issue

Bill Moseley moseley at hank.org
Thu Sep 21 06:33:33 CEST 2006

I had one user complain that when they submitted a form they were
getting a 500 error, yet when reviewing their transaction it was
successfully completed.

But, reviewing the logs I saw an error (a failed transaction) and the
access logs showed two posts at the same time -- the first successful
the second aborted due to the first being already completed.

I'm using C::P::RequestToken to prevent submitting forms twice, but
that still doesn't prevent a second request slipping in before the
token is invalidated.  Perhaps need atomic update for the token stored
in the session.

Even if I trap the exception the user is still going to get a
confusing message if they double post.  Instead of "Transaction
Complete" they will see "Sorry, this transaction is already complete"
kind of thing.

I'm wondering what others are doing to deal with double-posts.  Is
using Javascript to disable the form after posting helpful?  I doubt
it since I would think click submit + <Esc> + click submit would still

BTW -- I have not been able to duplicate the double post -- that is,
double clicking on the submit button (or image) won't trigger it in
FF or my version of IE, although in FF I was able to hit <Esc>
between clicks and generate the double post.  I suspect it's just
the behavior in some version of IE.

Ah the fun of all those versions of browsers:

I had another IE user where they claimed the form on the "login" page
would just clear the fields when they hit submit, but if they used the
login on the side-navigation it worked fine.  Of course, it's the same
form on both pages -- generated by the same template:

        [% PROCESS includes/login_form %]

so it's bit of a mystery why one form would work and not the other.

Bill Moseley
moseley at hank.org

More information about the Catalyst mailing list