473,791 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disabling button

Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(

S

Jan 30 '07 #1
3 3481
1)Find your button
ex:var myu_btn = document.getEle mentById("submi t_btn");
2)disable it
myu_btn.disable d = true;

A button being disabled or inabled is just one of it's attributes.
Alternately you can search your page for all input tag elements where
the type attribute is 'button' or 'submit' and disable them. For more
info just google input tag attributes.
On Jan 30, 6:26 am, "Sonnich" <sonnich.jen... @elektrobit.com wrote:
Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(

S
Jan 30 '07 #2


On Jan 30, 5:09 pm, Curtis.Dani...@ gmail.com wrote:
1)Find your button
ex:var myu_btn = document.getEle mentById("submi t_btn");
2)disable it
myu_btn.disable d = true;

A button being disabled or inabled is just one of it's attributes.
Alternately you can search your page for all input tag elements where
the type attribute is 'button' or 'submit' and disable them. For more
info just google input tag attributes.
On Jan 30, 6:26 am, "Sonnich" <sonnich.jen... @elektrobit.com wrote:
Thanks

I found something like:

function disableSubmits( form)
{
for (var i = 0; i < form.elements.l ength; i++)
if (form.elements[i].type.toLowerCa se() == 'submit')
form.elements[i].disabled = true;
}

and...

echo "<form method=post name='myform' action='".$sTem p."'
ONSUBMIT=\"if (this.submitted ) return false; else
{ this.submitted = true; disableSubmits( this); return true; }\"
>";
but my problem is that I have 2 buttons for submit (2 ways), and when
adding this only the first one works - it disable the buttons, but
also the functionality of the second one.

can anyone help

BR
S

Jan 30 '07 #3
Sonnich wrote on 30 jan 2007 in comp.lang.javas cript:
Hi all!

Say, I have <buttonor <input type="submit">, how do then disable
them once they are clicked?

I could not find the right thing on the net :-(
<button
onclick='alert( "No more");this.dis abled=true'>
Click me once
</button>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 30 '07 #4

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

Similar topics

22
2602
by: Papajo | last post by:
This simple script counts up or down with a button click, now can it be modified so the count won't go below zero?            Thanks, Joe <form> <input type=text name=amount size=4 value=> <input type=button value="up" onClick="javascript:this.form.amount.value++;"> <input type=button value="down" onClick="javascript:this.form.amount.value--;">
5
5056
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main form record. In each page of the tab control, there are three buttons: Add, Update, Delete. Any of these buttons will open another, smaller form to add, update or delete the related data record. Originally, I had placed the smaller form such...
4
4181
by: Steve | last post by:
I have the MDI MFC application ported to .NET. Now this application include mixed managed/unmanaged code. The application displays progress dialog with the cancel button during lenghtly operation. This progress dialog implemented as modeless to allow user to cancel the lenghtly operation if he wishes. At the same time I disable mainframe window to prevent user from clicking on the menu bar. Here is the segment of the code:
2
7796
by: Jeelz | last post by:
Hi Guyz, Would appriciate any tip on disabling an ASP.NET LinkButton using client sided code like javascript. My Requirement is such that the user should be allowed to click on the link button only once (viz. he should not be allowed to submit the form twice). This stuff is easy when using a ASP:Button or HTML Button... but a link button has got me wondering how... plz help!
3
2103
by: Paul | last post by:
Hi I am trying to create an "Update" button for my form. So far I have got it working fine, posting back and updating the record. Great! However, I now want to make it so that when a user presses "Update", the caption changes to "Updating..." and the button disables (to prevent multiple form
4
2361
by: Dan =o\) | last post by:
Hi guys, in the scenario where a user fills in a form, and clicks on a button to Save, there's a period of waiting (the slower the connection between client and server, the longer the delay) where the user may be oblivious and could say, press the button twice, or even fill in some more data on the form... When the postback completes, any data entered in during this delay is lost. How do I, when the user clicks on a button, process...
7
6994
by: Vignesh | last post by:
I have tab control which has some TabPages. I want to enable or disable the tabpages based on some condition. It is possible to that. Thanks in advance.
2
6320
by: dougawells | last post by:
Hi- I'm wanting to have a set of radio buttons disabled when a form is displayed, then if they check another specific radio button, those would become enabled. I've tried setting it via window.document.formname.radiogroup.disabled="true"; (or false) - but that doesn't seem to work. I've seen this done with text boxes, but not with radio buttons. Can anyone give any help? Thanks
3
3808
by: ChrisN | last post by:
Invoking a postback before a large ASP.NET page has fully rendered will often cause the page to crash. This is unhelpful and confusing to users. I'm wondering if I can overcome this by disabling any controls that invoke a postback until the page is fully rendered, ie setting the controls disabled server-side, serving the page and then having a JavaScript routine right at the bottom of the page re-enable them client-side.
0
9515
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
10426
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
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
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
9993
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
6776
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();...
0
5430
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...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
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

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.