473,763 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering or avoiding double click on form submission

Despite searching the net, I can't find a suitable solution that prevents a
user's double click from submitting a form twice. I'm currently using the
following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">

While it prevents multiple single clicks, it isn't good enough for a fast
double click, such as found on some multi-button mice.

Anyone have a better solution?

--
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
Oct 14 '08 #1
14 3388
On Oct 15, 12:01*am, Ed Jay wrote:
Despite searching the net, I can't find a suitable solution that preventsa
user's double click from submitting a form twice. I'm currently using the
following in a button element:
<input type="button" onclick="this.d isabled=true;th is.form.submit( );">
While it prevents multiple single clicks, it isn't good enough for a fast
double click, such as found on some multi-button mice.
Have a look at
http://www.dynamicdrive.com/dynamici...submitonce.htm

I do not know if is fast enough for all mice,
and using cats would not be very nice.
Oct 14 '08 #2
Ed Jay wrote:
Despite searching the net, I can't find a suitable solution that prevents a
user's double click from submitting a form twice. I'm currently using the
following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">
Use a submit button and don't call this.form.submi t();

<input type="button" onclick="this.d isabled=true;">

This makes the form accessible when js is not enabled.

What happens when the user's connection drops after the user fills out
the form, but before pressing submit?

If you've used a wireless connection, you've no doubt run into that
problem. It's a bad effect that I remember experiencing on GG and GMail
many times.

Garrett

--
comp.lang.javas cript FAQ <URL: http://jibbering.com/faq/ >
Oct 14 '08 #3
dhtml wrote:
Ed Jay wrote:
>Despite searching the net, I can't find a suitable solution that
prevents a
user's double click from submitting a form twice. I'm currently using the
following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">

Use a submit button and don't call this.form.submi t();

<input type="button" onclick="this.d isabled=true;">
I meant:

<input type="submit" onclick="this.d isabled=true;">
This makes the form accessible when js is not enabled.

What happens when the user's connection drops after the user fills out
the form, but before pressing submit?

If you've used a wireless connection, you've no doubt run into that
problem. It's a bad effect that I remember experiencing on GG and GMail
many times.
So can be replaced with:
<input type="submit">

If you need to filter double requests on the server, put a hidden in the
form. When the token comes, you've got your request. Subsequent
submissions with that token can be ignored.

Garrett
Garrett

--
comp.lang.javas cript FAQ <URL: http://jibbering.com/faq/ >
Oct 14 '08 #4
my************* ******@googlema il.com scribed:
>On Oct 15, 12:01*am, Ed Jay wrote:
>Despite searching the net, I can't find a suitable solution that prevents a
user's double click from submitting a form twice. I'm currently using the
following in a button element:
<input type="button" onclick="this.d isabled=true;th is.form.submit( );">
While it prevents multiple single clicks, it isn't good enough for a fast
double click, such as found on some multi-button mice.

Have a look at
http://www.dynamicdrive.com/dynamici...submitonce.htm

I do not know if is fast enough for all mice,
and using cats would not be very nice.
Thanks. Tried it, and it failed.

--
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
Oct 14 '08 #5
dhtml scribed:
>Ed Jay wrote:
>Despite searching the net, I can't find a suitable solution that prevents a
user's double click from submitting a form twice. I'm currently using the
following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">
Use a submit button and don't call this.form.submi t();

<input type="button" onclick="this.d isabled=true;">

This makes the form accessible when js is not enabled.
Not a problem with js disabled, as the user cannot access the form unless js
is enabled.
>
What happens when the user's connection drops after the user fills out
the form, but before pressing submit?

If you've used a wireless connection, you've no doubt run into that
problem. It's a bad effect that I remember experiencing on GG and GMail
many times.
Good point, in general, but this is a web app in a doctor's office, so
losing a wireless connection doesn't pose a problem.

--
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
Oct 15 '08 #6
rf

"dhtml" <dh**********@g mail.comwrote in message
news:gd******** **@registered.m otzarella.org.. .
dhtml wrote:
>Ed Jay wrote:
>>Despite searching the net, I can't find a suitable solution that
prevents a
user's double click from submitting a form twice. I'm currently using
the
following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">

Use a submit button and don't call this.form.submi t();
If you need to filter double requests on the server, put a hidden in the
form. When the token comes, you've got your request. Subsequent
submissions with that token can be ignored.
Or cause the server side script to issue a redirect to a "thankyou" page.
This can be extended to representing (without processing) the form page when
you find invalid values.
Oct 15 '08 #7
Ed Jay wrote:
Despite searching the net, I can't find a suitable solution that
prevents a user's double click from submitting a form twice. I'm
currently using the following in a button element:

<input type="button" onclick="this.d isabled=true;th is.form.submit( );">

While it prevents multiple single clicks, it isn't good enough for a
fast double click, such as found on some multi-button mice.

Anyone have a better solution?
The only and best way to ensure this isn't an issue, is coding the
script to only execute the necessary functions on the first click. All
of the logic must be done in the script, and it's always best to code
scripts to not create a problem if a user was to submit the form over
once. Things like JavaScript on the browser end probably won't hurt,
but shouldn't be relied upon. Use some custom session instead and
control what happens and anticipate the things such as a double
submission.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
Oct 15 '08 #8
dhtml scribed:
>>Despite searching the net, I can't find a suitable solution that
prevents a user's double click from submitting a form twice. I'm currently using the
following in a button element:
If you need to filter double requests on the server, put a hidden in the
form. When the token comes, you've got your request. Subsequent
submissions with that token can be ignored.
Doesn't thin presuppose that the same instance of the script is running for
both submissions?

--
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
Oct 15 '08 #9
Ed Jay wrote:
<input type="button" onclick="this.d isabled=true;th is.form.submit( );">

While it prevents multiple single clicks, it isn't good enough for a fast
double click, such as found on some multi-button mice.

Anyone have a better solution?
Caveat: I'm a Javascript novice.

Can you change your <inputso that it does a submit from the "onclick"
handler? The code that does the submit could then ignore a second click.

In concept:

onload sets come counter to 0
onclick increments the counter, and submits the form iff counter=1
--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Oct 15 '08 #10

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

Similar topics

1
3793
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your HTML form to. the actual form-parsing page resides on a server that's uneditable to me since it sits on an inaccessible server. my problem is more irritating than anything; everything double-submits.. when you submit the form, I've forced a...
4
2004
by: jfancy-Transport Canada | last post by:
Hi, I'm looking for an asp page to detect if there are any characters in my contact form that shouldn't be there. For example, if there is a "<" character, then this may mean there is html in my contact form, which is not good. I want to build a string that has all the values of my textboxes in my contact form. Its not working? Have a look: <%
19
3568
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
2
5472
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would like to eventually be able to filter down through the tables untill i can reach one unique record. I am creating a datbase to keep track of registered accounts for a stae program. Each account is registered into the program through a two...
1
5250
by: mstery | last post by:
I have a report generated via an ID selection made in a dropdown on a form. The report filters by an on click event in a preview report button on the form. Everything in the report, including subreports, filters perfectly, with the exception of a running sum DLookup field on the main report. This field looks up a value in a foreign table. I'm not clear where I'm supposed to be filtering this field, since it obviously isn't picking up the...
0
3645
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
7
3706
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a satisfactory answer (check your browser) so now that I've had the time to set up a reasonable little test that I can post somewhere, I'll try again. The app I've written has three ASPX pages. One is a combined page which writes a little text...
1
7456
by: DarthOptimus | last post by:
Hi, There is javascript code on my jsp to prevent double submission of a form: <SCRIPT type="text/javascript" language="JavaScript"> var firstSubmit = true; function isFirstSubmit() {
15
4960
by: ABC | last post by:
Hi, I have a problem with Double submission in html forms. I am using PHP as the server side scripting language, i have found a means to capture the second form submission while the first form submission is still in-progress. Basically, i can use sessions to check if the first submission is active and reject subsequent submits. ***I do not want to try any client side solution(such as disabling submit button) as hitting F5 on the...
0
9566
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9389
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10149
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9828
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8825
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7370
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3918
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3529
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2797
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.