in reply to Avoiding a second click

The easiest solution is just to put a small, tiny little disable function right inside your form. We use this for the e-commerce sites we build and it works great -- no multiple clicks yet!
<form .... blah ... OnSubmit="this.my_form_button.disabled=true;"> <input blah> <input blah> <input type="submit" name="my_form_button" value="Click Here"> </form>
As soon as they click the button, it is automatically disabled, and they cannot click it again (even if they are superman).

Michael Jensen
michael at inshift.com
http://www.inshift.com

Replies are listed 'Best First'.
Re: just disable the button!
by hacker (Priest) on Jun 12, 2002 at 13:43 UTC
    ..except in the case of PDA, WAP, text-mode, and browsers with Javascript disabled (such as High-Security IE, Mozilla's new Javascript function granularity, etc.)

    Javascript solutions are only applicable when you can absolutely, posititively, 100% verify the client configuration.. i.e. locked down intranet usage. Anything else is just a "best-guess" approach.

    Rule 1: Never trust the client (config)

    Your solution may work, but isn't bulletproof. I'm accustomed to having to code my web-based work against a minimum of 11 browsers (IE, Konqueror, Galeon, Opera, Dillo, Mozilla, Netscape, Lynx, Links, Amaya, and w3m). In my case, pages must validate to XHTML 1.0 Transitional and be 100% CSS1 and CSS2 compliant. Very strict requirements, but the end result is near-perfection (and yes, the pages look good too, and I don't have to use tables or Javascript)

    Another approach to this is to take a simple submit form, and send the user to a confirm form, which has an expiration set. If the user clicks Back and tries to resubmit, the confirmation form will fail. Instead of submitting directly from the main entry form, submit the values from a "Are these values correct?" type of page.

    TMTOWTDI.