in reply to Netscrape and forms (Slightly Off Topic)

Not so off-topic as you might think. Even if there's a problem in your Javascript somewhere (that stealth-submits on you or something), stopping double-submits is a good trick to have in your CGI programmin' toolkit.

One way I might do it is to generate a unique ID for each form instance and add it as a hidden field to the form HTML; then you can check, in your form processing script, whether a form with that ID has already been submitted.

HTH

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

  • Comment on Re: Netscrape and forms (Slightly Off Topic)

Replies are listed 'Best First'.
Re: Re: Netscrape and forms (Slightly Off Topic)
by zakzebrowski (Curate) on Apr 17, 2001 at 20:00 UTC
    Yeah, I was planning on doing that, but I was first wondering if there was a way we could control what the browser itself was sending... (I will be attempting to clean up the javascript code that we currently have anyways, but I was hoping there was a quick fix in Netscape land first.) Thanks Zak

      You could put an onsubmit attribute in your form tag and have the Javascript in that attribute redirect to a "processing" page (anything that gets you off the current page -- but it would have to be fast to prevent the problem). Or it could set a variable "submitted" that, if true, would disable further submissions.

      Philosophy can be made out of anything. Or less -- Jerry A. Fodor

        Actually that is what I currently have. Pesudo code:
        <script language="javascript"> function check (thisform) { if (WhereToGo=="XXX") thisform.submit(); -- other logic here as well else alert("play nice"); } </script> <INPUT TYPE="HIDDEN" name="WhereToGo" Value="XXX"> <INPUT TYPE="Button" name="SomeActionGoesHere" Value="Add something to + form" onClick="check(this);">

        The problem is that double submits are still happening. <GRIPE>(And actually, with IE too... just discovered that bug. Grr. If the world *only* used Opera...)</GRIPE> The only problem with integrating with the database is that the database itself is getting pretty large and to request a new insert database object here takes a few days (or more) to get implemented... Thanks Zak