Is there a way to disable a button after it is clicked?
I am trying to avoid having someone click on it twice while they wait for it
to process.
Thank you!
Nov 19 '05
16 3458
Hi Bishoy,
That is what it is supposed to do. Let's say you are doing a credit card
payment. It makes sure the user can only click once. Then after processing
is done they are redirected to a success or failure page. It also lets the
user know that they can only click the button once. On your site I can get
in over a dozen clicks before the page comes back to alert me. This also
means I posted 10 requests to your server instead of just one. If you were
doing a database app that required a few seconds to process and has multiple
steps it will really get hammered and you'll need to rollback 9 transactions
that may have started before the first transaction completed. While you
should have the logic to rollback those transactions in your app it is best
to do what you can to make sure you only need to executed a minimum number
of times. Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"Bishoy George" <bi****@bishoy. com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. I tried the code submitted by Ken Dopierala Jr. It disable the button for a second then when the page is refreshed due to post back, it is enabled again.
Also the code of Sreejith Ram is not working.
Bishoy http://bishoy.com -----------------------------------------------------
"Barry Gilmore" <no**********@y ahoo.com> wrote in message news:ro******** ******@tornado. rdc-kc.rr.com... Is there a way to disable a button after it is clicked?
I am trying to avoid having someone click on it twice while they wait
for it to process.
Thank you!
Hi Ken,
Your opinion is very reasonable.
But, I want an extra code to prevent the disabled button by adding
attributed from become active again.
Thanks.
Bishoy
------------------------------------------------------------------------
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Hi Bishoy,
That is what it is supposed to do. Let's say you are doing a credit card payment. It makes sure the user can only click once. Then after processing is done they are redirected to a success or failure page. It also lets the user know that they can only click the button once. On your site I can get in over a dozen clicks before the page comes back to alert me. This also means I posted 10 requests to your server instead of just one. If you were doing a database app that required a few seconds to process and has multiple steps it will really get hammered and you'll need to rollback 9 transactions that may have started before the first transaction completed. While you should have the logic to rollback those transactions in your app it is best to do what you can to make sure you only need to executed a minimum number of times. Ken.
-- Ken Dopierala Jr. For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight If you sign up under me and need help, email me.
"Bishoy George" <bi****@bishoy. com> wrote in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. I tried the code submitted by Ken Dopierala Jr. It disable the button for a second then when the page is refreshed due to post back, it is enabled again.
Also the code of Sreejith Ram is not working.
Bishoy http://bishoy.com -----------------------------------------------------
"Barry Gilmore" <no**********@y ahoo.com> wrote in message news:ro******** ******@tornado. rdc-kc.rr.com... > Is there a way to disable a button after it is clicked? > > I am trying to avoid having someone click on it twice while they wait for > it to process. > > Thank you! > >
Well Bishoy, I think the issue we trying to address is , if the user click
multiple times on submit button, the client browser would send multiple post
requests to the web server. This happens a lot when the client connection is
slow. Our code doesnt have any control on this because the browser would
think these are 2 diffrent posts by the user.
The simplest solution for it is to stop the user from clicking multiple
times by disabling the button at clientside after the first click. .so that
multiple requests are not send to the server by the browser. Like Justin
Gengo pointed this wouldnt work if you have validators though ..
Once you are at the Server Side OnClick event, you would be able to take the
additional step of disabling the button , clearing form data, redirecting the
page etc etc depending on the requirement of your app. But if you disable the
submit button for good, how will the user make the next submit?
"Bishoy George" wrote: Hi Ken, Your opinion is very reasonable.
But, I want an extra code to prevent the disabled button by adding attributed from become active again.
Thanks. Bishoy
------------------------------------------------------------------------
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Hi Bishoy,
That is what it is supposed to do. Let's say you are doing a credit card payment. It makes sure the user can only click once. Then after processing is done they are redirected to a success or failure page. It also lets the user know that they can only click the button once. On your site I can get in over a dozen clicks before the page comes back to alert me. This also means I posted 10 requests to your server instead of just one. If you were doing a database app that required a few seconds to process and has multiple steps it will really get hammered and you'll need to rollback 9 transactions that may have started before the first transaction completed. While you should have the logic to rollback those transactions in your app it is best to do what you can to make sure you only need to executed a minimum number of times. Ken.
-- Ken Dopierala Jr. For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight If you sign up under me and need help, email me.
"Bishoy George" <bi****@bishoy. com> wrote in message news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. I tried the code submitted by Ken Dopierala Jr. It disable the button for a second then when the page is refreshed due to post back, it is enabled again.
Also the code of Sreejith Ram is not working.
Bishoy http://bishoy.com -----------------------------------------------------
"Barry Gilmore" <no**********@y ahoo.com> wrote in message news:ro******** ******@tornado. rdc-kc.rr.com... > Is there a way to disable a button after it is clicked? > > I am trying to avoid having someone click on it twice while they wait for > it to process. > > Thank you! > >
Sreejith Ram wrote: The simplest solution for it is to stop the user from clicking multiple times by disabling the button at clientside after the first click. .so that multiple requests are not send to the server by the browser. Like Justin Gengo pointed this wouldnt work if you have validators though ..
The following will work even if you have validation controls:
System.Text.Str ingBuilder sb = new StringBuilder() ;
sb.Append("if (typeof(Page_Cl ientValidate) == 'function') { ");
sb.Append("if (Page_ClientVal idate() == false) { return false; }} ");
sb.Append("this .value = 'Please wait...';");
sb.Append("this .disabled = true;");
sb.Append(Page. GetPostBackEven tReference(btnS ubmit));
sb.Append(";");
btnSubmit.Attri butes.Add("oncl ick", sb.ToString());
--
Jim Cheshire
JIMCO Software http://www.jimcosoftware.com
thanks
"JIMCO Software" wrote: Sreejith Ram wrote: The simplest solution for it is to stop the user from clicking multiple times by disabling the button at clientside after the first click. .so that multiple requests are not send to the server by the browser. Like Justin Gengo pointed this wouldnt work if you have validators though ..
The following will work even if you have validation controls:
System.Text.Str ingBuilder sb = new StringBuilder() ; sb.Append("if (typeof(Page_Cl ientValidate) == 'function') { "); sb.Append("if (Page_ClientVal idate() == false) { return false; }} "); sb.Append("this .value = 'Please wait...';"); sb.Append("this .disabled = true;"); sb.Append(Page. GetPostBackEven tReference(btnS ubmit)); sb.Append(";"); btnSubmit.Attri butes.Add("oncl ick", sb.ToString());
-- Jim Cheshire JIMCO Software http://www.jimcosoftware.com
Jimco,
Yes, that's what my disable submit function (submitted above) does.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"JIMCO Software" <co*******@jimc osoftware.com> wrote in message
news:u4******** ********@tk2msf tngp13.phx.gbl. .. Sreejith Ram wrote: The simplest solution for it is to stop the user from clicking multiple times by disabling the button at clientside after the first click. .so that multiple requests are not send to the server by the browser. Like Justin Gengo pointed this wouldnt work if you have validators though ..
The following will work even if you have validation controls:
System.Text.Str ingBuilder sb = new StringBuilder() ; sb.Append("if (typeof(Page_Cl ientValidate) == 'function') { "); sb.Append("if (Page_ClientVal idate() == false) { return false; }} "); sb.Append("this .value = 'Please wait...';"); sb.Append("this .disabled = true;"); sb.Append(Page. GetPostBackEven tReference(btnS ubmit)); sb.Append(";"); btnSubmit.Attri butes.Add("oncl ick", sb.ToString());
-- Jim Cheshire JIMCO Software http://www.jimcosoftware.com
S. Justin Gengo wrote: Jimco,
Yes, that's what my disable submit function (submitted above) does.
Sorry if reposted. I posted in response to a "doesn't work with validators"
post. I hide read posts, do unless I happen to remember a previous post's
content, it's gone clear into another realm by the time I might respond. ;)
--
Jim Cheshire
JIMCO Software http://www.jimcosoftware.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: nntp |
last post by:
I have a set of links which I want search engines to crawl them, but I want
to disable them from my visitors, so I will ask the link owners to pay me to
let me enable them.
<a disabled href="#">bahbahbah</a>
Does not work, as it is still clickable. It only changes the color to grey.
|
by: Suni |
last post by:
Hi everybody,
But what I am trying to do is like, there are 2 forms, and if I click on the
button in form1, it'll open up form2 and disable the button in form1. Then
when I click on the button in form2, it will close form2, and then enable
the button in form1. Could you please give me some hints about this?
Thanks,
Suni
|
by: techfuzz |
last post by:
I scoured this group and others looking for the best way to disable a
button after the first click to prevent multiple submissions, but
never did find anything that worked like they said it would. I went
ahead and wrote my own bit of code so I'm sharing it here for
everyone. Even though it doesn't really disable the button by greying
it out, it prevents the multiple submissions which it what I was
attempting to prevent all along. ...
|
by: Sinity |
last post by:
Anyone knows the method/codes to disable the clicked button after first
click by using .aspx-- to prevent people to click many time when waiting for
the server response.
I tried to do this by adding a java script for the button. But, useless..
Please help! Thank you
|
by: Jeff |
last post by:
I have a payment form with a submit button. A large percentage of users
double-click the submit button thus submitting their payment information
twice. I would like to use javascript to disable the submit button once
it's been clicked, yet still have the form submit. I can do this in ASP
2.0, however, ASP.Net seems to be adversely affected if you disable the
submit button. Here's how I have it set up...
The submit button is a...
| |
by: Robert Ladd |
last post by:
Hi,
I'm trying to disable the asp.net calendar control from a javascript
function, but it doesn't disable the doPostBack.
To simplify the situation, assume a page with 4 controls. A dropdownlist, a
calendar control, a textbox and an update button. What I'm doing is
initially setting the button to disabled, the other 3 controls are enabled.
If any data is entered in the textbox, I want to disable the dropdownlist
and the calendar...
|
by: Buddy Ackerman |
last post by:
If I put client side code to disable a button (so that a user doesn't click
it twice and double post the form) then teh button doesn't get posted with
the form and the button's server-side click event handler is not fired.
Seems like a big hole in the ASP.NET form handling process. Any way around
it and still use the button click event handler?
--Buddy
|
by: Ahmad Jalil Qarshi |
last post by:
Hi!
I have a problem while developing some webpages.The Problem is that:-
How We Can Disable The Controls Of One Web Form From Other Web Form In
Asp.net?
Explanation:-
There Should Be Two Web Form,Web Form1.aspx and Web Form2.aspx,Now From Web
Form1.aspx When I Click One Button (Disable), Then Web Form2.aspx Buttons
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I disable the right mouse button?
-----------------------------------------------------------------------
The oncontextmenu intrinsic event is the only safe and reliable
method. Of the other approaches often presented, most depend on
an alert box interrupting the process and rarely work. Note that
oncontextmenu is a non-standard event and is not...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |