[LRUG] Double submit

Andrew Stewart boss at airbladesoftware.com
Fri Apr 24 01:43:56 PDT 2015


Hello LRUG!

Some people using my Rails app are speedy double-clickers of form submit buttons.  While I admire their alacrity I would like Rails to ignore the duplicate submissions.

Disabling the submit button client-side heads off the quick-but-not-lightning double-clickers.  However a special few still outpace the browser so I am after a server-side solution.

I imagine each form submission would have a unique token and the server would ignore or raise an error for submissions with duplicate tokens within a rolling window of, say, a few seconds.  Perhaps this would be handled in a Rack middleware.

Does such a thing already exist?  I know this is an old problem but I can't seem to find any decent solutions.

Thanks in advance!

Yours,

Andy Stewart


More information about the Chat mailing list