473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable submit button once it is clicked.

zlf
How to disable button once it is clicked on the page? The codes in click
event of submit button is time-costing(about 4-5 secs), in this period, user
maybe do a re-submit, that is not expected.

Thanks

zlf
Dec 28 '07 #1
5 2319
"zlf" <zl***@hotmail. comwrote in message
news:uY******** ******@TK2MSFTN GP02.phx.gbl...
How to disable button once it is clicked on the page? The codes in click
event of submit button is time-costing(about 4-5 secs), in this period,
user maybe do a re-submit, that is not expected.
<asp:Button ID="cmdSubmit" runat="server" Text="Submit"
OnClick="cmdSub mit_Click" OnClientClick=" this.disabled=t rue;" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 28 '07 #2
Clickety-Click Clickety-Click
Mark's solution was really slick.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:OB******** ******@TK2MSFTN GP06.phx.gbl...
"zlf" <zl***@hotmail. comwrote in message
news:uY******** ******@TK2MSFTN GP02.phx.gbl...
>How to disable button once it is clicked on the page? The codes in click
event of submit button is time-costing(about 4-5 secs), in this period,
user maybe do a re-submit, that is not expected.

<asp:Button ID="cmdSubmit" runat="server" Text="Submit"
OnClick="cmdSub mit_Click" OnClientClick=" this.disabled=t rue;" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 28 '07 #3
zlf
Thanks!
I have another question. How to re-enable it once an exception occurs?
Now, if exception occurs, a message box pops up and the button remains
disabled. So I cannot click that button till I refresh that page manually.

"Mark Rae [MVP]" <ma**@markNOSPA Mrae.net>
??????:OB****** ********@TK2MSF TNGP06.phx.gbl. ..
"zlf" <zl***@hotmail. comwrote in message
news:uY******** ******@TK2MSFTN GP02.phx.gbl...
>How to disable button once it is clicked on the page? The codes in click
event of submit button is time-costing(about 4-5 secs), in this period,
user maybe do a re-submit, that is not expected.

<asp:Button ID="cmdSubmit" runat="server" Text="Submit"
OnClick="cmdSub mit_Click" OnClientClick=" this.disabled=t rue;" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 2 '08 #4
"zlf" <zl***@hotmail. comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>>How to disable button once it is clicked on the page? The codes in click
event of submit button is time-costing(about 4-5 secs), in this period,
user maybe do a re-submit, that is not expected.

<asp:Button ID="cmdSubmit" runat="server" Text="Submit"
OnClick="cmdSu bmit_Click" OnClientClick=" this.disabled=t rue;" />

I have another question. How to re-enable it once an exception occurs?
Now, if exception occurs, a message box pops up and the button remains
disabled. So I cannot click that button till I refresh that page manually.
Where does the error occur? What causes the message to pop up?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 2 '08 #5
zlf
asp:UpdatePanel pops exceptions up.

I tried the script below, but it fails "Object expected" after 5 secs I
click the button. Can you tell me what is wrong with my script?

SelectAllButton .Attributes["onclick"] =
GetPostBackEven tReference(Sele ctAllButton) +
";getElementByI d('SelectAllBut ton').disabled= true;setTimeout (\"getElementBy Id('SelectAllBu tton').disabled =false\",5000); ";

Thanks

"Mark Rae [MVP]" <ma**@markNOSPA Mrae.net>
??????:%2****** *********@TK2MS FTNGP02.phx.gbl ...
"zlf" <zl***@hotmail. comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>>>How to disable button once it is clicked on the page? The codes in
click event of submit button is time-costing(about 4-5 secs), in this
period, user maybe do a re-submit, that is not expected.

<asp:Button ID="cmdSubmit" runat="server" Text="Submit"
OnClick="cmdS ubmit_Click" OnClientClick=" this.disabled=t rue;" />

I have another question. How to re-enable it once an exception occurs?
Now, if exception occurs, a message box pops up and the button remains
disabled. So I cannot click that button till I refresh that page
manually.

Where does the error occur? What causes the message to pop up?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 3 '08 #6

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

Similar topics

5
33295
by: http://links.i6networks.com | last post by:
I want to force the users to click submit to submit the forms. How do I disable "Enter Key" which will submit the form automatically when they entered the data in text field then pressed "enter key"
14
7184
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
4
10680
by: James Brett | last post by:
I have one form on the page but have multiple submit buttons for different elements. When clicking on a button not associated with the required elements the validator popup still comes up. How can I disable requiredfieldvalidator fields when I click on non associated button? Cheers James
6
4042
by: GD | last post by:
Hi, I wonder how to disable the "submit" behavior of a button. What I want is to assign values to dynamically added user controls without page postback. Problem: dynamically created control can not be accessed because the button click trigers page postback(see sample code). When the button is clicked, an error occurs: "System.NullReferenceException: Object reference not set to an instance of an object." Please help. Thanks.
1
2194
by: microsoft | last post by:
I am looking for code for a button on a website, and I want it to prevent users from clicking more than once while their request is being processed. I would like it to disable or hide the button once clicked and then enable it after the process is completed from either the server or a web dialog box. I did find a sample on disabling the button while the server is processing their request and the sample was found here: ...
3
3163
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...
16
3446
by: Barry Gilmore | last post by:
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!
5
2348
by: sumeetmakkar | last post by:
Hi all, I am a begineer and working on a project. Facing trouble linking a submit buuton to a page of my choice.Script i am using is: <SCRIPT language=JavaScript><!-- function validate(form) { for (var i=0; i <form.elements.length; i++) { if (form.elements.type == 'button') { if (!form.elements.clicked) { alert('Complete the 1st line checks!');
3
2562
parshupooja
by: parshupooja | last post by:
Hey all, I have button on page. OnClick event I am saving records to database, which takes couple of seconds, meanwhile if user becomes impatient and clicks again, it triggers save again. I want to disable button once clicked and save records too. I tried using javascript on OnClientClick to disable button, but unable to acheive both things together,it either save records or disable button. <asp:Button ID="btnSave" runat="server" ...
0
8674
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
8603
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,...
1
8895
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,...
0
8861
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
7725
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
6518
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...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.