473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to avoid multiple submit button click??????

i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem????

thxs for help in advance

Jul 17 '05 #1
8 7535
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable vishal's handwriting:
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem????

thxs for help in advance


<H1 style='color:red; font-weight:bold; font-style:italic;
font-decoration:underline; background: green'>Now don't you even TRY to
click this button twice!</H1>
<INPUT type='submit' ...>

;)

Seriously, you could simply check if the data has been already written,
or generate a random ID in a hidden input, so that you know if data has
already been written.

Cheers
Mike
Jul 17 '05 #2

vishal Wrote:
so how can i solve this problem????

Just an idea: put a key in the user's session which must be present t
submit the form.

You could put this key in the session when the page with the submi
button is served from the server to the browser. When the form'
ACTION is processed, you could clear this key from the user's session.
If the key doesn't exist in the user session to begin with, you don'
process the POST.

If the user presses the brower's back button, the key would not b
present in their session, right? So the POST wouldn't be processed

--
Wyzcrak:: Posted from Tactical Gamer - http://www.TacticalGamer.com :

Jul 17 '05 #3
Micha? Wo?niak wrote:
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable vishal's handwriting:
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem????

thxs for help in advance


<H1 style='color:red; font-weight:bold; font-style:italic;
font-decoration:underline; background: green'>Now don't you even TRY to
click this button twice!</H1>
<INPUT type='submit' ...>


<input type'button' value='Submit' id='notReallyASubmit'
onclick='if (this.form.onsubmit()) {
this.form.submit();
this.enabled=false;
}'>

Maybe?

C.
Jul 17 '05 #4
On 08/04/2005 17:04, Colin McKinnon wrote:

[snip]
<input type'button' value='Submit' id='notReallyASubmit'
onclick='if (this.form.onsubmit()) {
this.form.submit();
this.enabled=false;
}'>

Maybe?


And if client-side scripting is unavailable? No, checking if data has
already been sent is much better, more reliable approach.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #5
Following on from vishal's message. . .
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem????

thxs for help in advance

With many of my pages is do a quick check on the referring page. This
stops simple back-button clicking and bookmarking which may be
inappropriate.
$_SERVER['HTTP_REFERER']. But read the manual for caveats.


--
PETER FOX Not the same since the submarine business went under
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Jul 17 '05 #6
I still like to replace submit buttons with disabled "please wait"
buttons on the client side
I don't rely on this, but it's good UI.

<FORM onSubmit="please_wait();">

or onClick/onChange,etc = "please_wait(this.form);"

function please_wait(whatform)
{
// sets value of all submit buttons to please wait and disables them
// whatform is optional
for ( f=0; f<document.forms.length; f++ )
{
var form = document.forms[f];
for ( i=0; i<form.length; i++ )
{
if ( typeof form.elements[i].type != 'undefined' &&
form.elements[i].type == 'submit' )
{
form.elements[i].disabled = true;
form.elements[i].value = 'Please Wait...';
}
}
}
// now submit form if specified
if ( typeof whatform != 'undefined' )
whatform.submit();
}

Jul 17 '05 #7
vishal wrote:
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem????

thxs for help in advance


Does your database table have a unique constraint? If not, choose which
column or columns should always be unique and put on a constraint. Any
approach which is not in the database itself is subject to failure.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Jul 17 '05 #8
I noticed that Message-ID: <ru************@pluto.downsfam.net> from
Kenneth Downs contained the following:
thxs for help in advance


Does your database table have a unique constraint? If not, choose which
column or columns should always be unique and put on a constraint. Any
approach which is not in the database itself is subject to failure.


What is needed is not a unique constraint on the individual columns (for
example last_name will not be unique) but a unique constraint on the
tuple excluding the primary key. Does MySQL do this?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: el_roachmeister | last post by:
Is there a way to make a text link post to a form without passing all the parameters in the url? The urls tend to get very long and messy. I often wonder if there is a limit to how long they can...
4
by: Diane Selby | last post by:
Hi- I am developing an ASP.NET application that can take a few seconds to process the request from the user. We are looking for a client-side solution that will prevent users from resubmitting...
3
by: Mark | last post by:
This is a solution... Often users want to keep clicking "submit" when they are waiting for server processing. Most apps these days like to disable the submit button to prevent this. You can't just...
11
by: Homam | last post by:
The ASP.NET model is touted as a clean OO approach to developing web pages, yet sometimes the page lifecycle poses silly obstacles that forces you revert to the Olde ASP 3.0 Ways. Here's a rough...
4
by: Hul Tytus | last post by:
comp.infosystems.www.authoring.html multiple submits When multiple submit lines are placed in an HTML form, the string returned to the server shows the name=value field for each one with no...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
5
by: mayur_hirpara | last post by:
Hi, I have been developing web applications for a while now. However, as I was thinking through the architecture I really don't understand the "How server can identify between which buttons has...
2
by: fliss | last post by:
Hello I have four submit buttons on my page - each carrying a value which refreshes the page selects from my db and displays the results in the drop down. The prob is i would like another...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.