[Nitro] de-bouncing Submit Order button
Bill Kelly
billk at cts.com
Wed Oct 10 15:29:49 EDT 2007
From: Arne Brasseur
> From: "Aidan Rogers" <aidan at yoyo.org>
> >>
> >> I'm writing an online store, and I don't want mine to be one of
> >> the ones that has to put bold-face warning text by the Submit
> >> button, saying: DANGER: PRESS THIS BUTTON ONLY ONCE!
> >
> > Why not deactivate the button on click and do the order processing
> > asynchronously?
>
> Good idea but breaks when Javascript is disabled/not available.
Indeed, I like the idea, thanks. My store currently uses no Javascript
at all, though.
Also I favor debouncing on the server side in the hopes of allowing
the client to recover from situations like:
- client clicks submit, but their wireless connection drops
after the POST, and they get a server timed out
- client clicks back button and clicks submit again; the server
sees the POST a second time, but that's fine
I think my proposed approach will handle these situations safely,
but it all depends on all Nitro requests being handled by a single
Ruby process.
That means I have to make sure the http server isn't set up to
proxy requests to multiple Mongrel processes, and such. (But we
have a low-traffic site, so I don't anticipate needing to scale
to multiple Mongrel processes anytime soon. If I did, I guess I
could use a filesystem lock instead of a Ruby Mutex.)
Regards,
Bill
More information about the Nitro-general
mailing list