Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

CGI::Application submitting twice

by aukjan (Friar)
on Jul 28, 2005 at 07:44 UTC ( [id://478865]=perlquestion: print w/replies, xml ) Need Help??

aukjan has asked for the wisdom of the Perl Monks concerning the following question:

I just started working with CGI::Application and have run into a weird little snag. I have created a simple Module which has three run-modes. The first shows data from a database, the second shows an edit page and the third handles the submition of the second mode. This third mode does a redirect to the 1st page on succes and to the 2nd on failure (when the database returns an error, this is done with stored procedures).

All works fine, but sometimes (for no appearent reason) the third mode is called twice after submitting the form (when only clicking the submit button once, yes I checked this). This became clear when I was getting errors from the database stating that data had already been deleted.

The scripts itself are fairly simple and no special things are done. I have tested with the same data over and over again and there 'seems' to be no pattern whatsoever. I am not even entirely sure that this is an CGI::Application problem, but I am a bit in the dark on this one since it seems to happen randomly.

Now I am just wondering if anyone has run into this problem and where I should continue looking...

Update: seems to happen only when running the cgi from explorer.

Update 2: -Hitting head on Table- Problem solved => I forgot a "return false;" in my calling the javascript submit function, and I kept reading over it! -Still hitting head on Table-

Replies are listed 'Best First'.
Re: CGI::Application submitting twice
by cees (Curate) on Jul 28, 2005 at 12:54 UTC

    Good catch on the return false JavaScript problem. Those are nasty ones and difficult to catch. I find another thing that happens to me more than I would like, is my designers putting in blank img tags <img src="">. That ends up loading the default URL again for the image, resulting in a double load. Although if it was a POST request, it will come with no parameters.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://478865]
Approved by monkfan
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-03-28 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found