Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to avoid mulitple submission of form in html

by Anonymous Monk
on Sep 10, 2011 at 00:51 UTC ( #925174=note: print w/replies, xml ) Need Help??


in reply to How to avoid mulitple submission of form in html

Hi,

Create an onclick trigger on your button which includes some javascript like -

doc1.getElementById("testBut1").disabled=true;

Should do the trick.

J.C.

Replies are listed 'Best First'.
Re^2: How to avoid mulitple submission of form in html
by afoken (Monsignor) on Sep 10, 2011 at 06:34 UTC
    Create an onclick trigger on your button which includes some javascript [...]] Should do the trick.

    Nope. Adding Javascript to the client will never solve a server side problem. Simply because Javascript is not always available on the client (LWP, WWW::Mechnanize, NoScript, filtering proxies, ...). And, quite obviously, it can be disabled on the client. In a WWW environment, you must not trust the client.

    The server has to detect that the form was submitted several times. The usual approach is to give each form a unique ID (e.g. a UUID) in a hidden field or as part of the submit URL; and to make sure that each and every ID is accepted exactly once.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://925174]
help
Chatterbox?
[hippo]: Other package managers are available
LanX wouldn't update system Perl!
[Discipulus]: prathap keerthipati might be it is better to install an alternative Perl instead and do not touch the system one
[LanX]: see perlbrew for alternative Perl installations
[marto]: unless you know exactly what you're doing an often saner option is to simply build another Perl rather than replace the system one

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2017-03-23 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.