473,799 Members | 3,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to force click event on disabled submit button

Hi all,

I'm new to these boards and my javascript experience is fairly limited
and basic so please bear with me. Anyway, on to the question and some
background. I'm developing using ColdFusion 4.5 and a good deal of the
page processing depends on whether or not a control is defined. To
prevent users from clicking on a submit button more than once or
clicking on another submit button before the page has finished
processing I have decided to use javascript to disable all of the
submit buttons on the page. However, this is preventing submission of
the form. When I try forcing the submit in the function, the
processing that should occur from clicking the submit button is
ignored and the submit button is not defined. Here is the code I am
using the commented code is different things I have tried:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled </title>
<script language="JavaS cript">
function fxnDisableBtn(f oo)
{
//alert(foo.type + ", " + foo.name + ", " + foo.value);
//document.frm1.f oo.click();
//document.frm1.s ubmit();
document.frm1.b tnSave.disabled = true;
document.frm1.b tnGoBack.disabl ed = true;
document.frm1.b tnReturn.disabl ed = true;
document.frm1.b tnForward.disab led = true;
//document.frm1.s ubmit();
//document.frm1.f oo.click();
switch(foo.name ){
case "btnSave":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnSave.click();
foo.click();
break;
//document.frm1.b tnSave.click();
case "btnGoBack" :
//alert(foo.type + ", " + foo.name);
document.frm1.b tnGoBack.click( );
//foo.click();
break;
case "btnReturn" :
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnReturn.click( );
break;
case "btnForward ":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnForward.click ();
break;
}
alert(foo.type + ", " + foo.name + ", " + foo.value + ", " +
foo.disabled + ", " + foo.click()); //debugging and checking foo
}
</script>
</head>

<body>
<form name="frm1" action="#Applic ation.RootPath#/master.cfm?"
method="post"></form>

<input type=submit name="btnSave" value="Save (Does Not Forward)"
onclick="fxnDis ableBtn(btnSave );">
<br><br>
<input type=submit name="btnGoBack " value=" <- Back "
onclick="fxnDis ableBtn(btnGoBa ck);">&nbsp;&nb sp;&nbsp;

<input type=submit name="btnReturn " value="Return"
onclick="fxnDis ableBtn(btnRetu rn);">&nbsp;&nb sp;&nbsp;

<input type=submit name="btnForwar d" value="Forward"
onclick="fxnDis ableBtn(btnForw ard);">
<br><br>

</body>
</html>
Jul 20 '05 #1
6 11401
In article <94************ **************@ posting.google. com>,
ja********@hotm ail.com (JSjones) writes:

Hi all,

I'm new to these boards and my javascript experience is fairly limited
and basic so please bear with me. Anyway, on to the question and some
background. I'm developing using ColdFusion 4.5 and a good deal of the
page processing depends on whether or not a control is defined. To
prevent users from clicking on a submit button more than once or
clicking on another submit button before the page has finished
processing I have decided to use javascript to disable all of the
submit buttons on the page. However, this is preventing submission of
the form. When I try forcing the submit in the function, the
processing that should occur from clicking the submit button is
ignored and the submit button is not defined. Here is the code I am
using the commented code is different things I have tried:


Please format your code for readability.

Instead of disabling the submit button, set a global variable and check its
state when the form tries to get submitted:

var submitForm = true;

function checkForm(){
if (submitForm){
//validation here
submitForm = false;
}
}

and anytime you need to "freeze" the page (stop the submit from working), set
submitForm to false, and when finished set it back to true.
--
Randy
Jul 20 '05 #2

Hi,

Is there no way to make the form submit after the button is disabled
I'm having exactly the same problem

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message30553.htm

Jul 20 '05 #3
On Tue, 27 Jan 2004 11:52:04 -0600, Unregistered
<Gu**********@m ail.forum4desig ners.com> wrote:
Is there no way to make the form submit after the button is disabled,
I'm having exactly the same problem?


No, not by clicking the button. Once disabled, it is just that: disabled.
The button stops receiving events and can't perform any actions, such as
submission.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #4
JSjones wrote:
I'm new to these boards
This is no (bulletin/message) board. You have posted to Usenet,
via the Google Groups web interface. That interface has its flaws,
so you better use NetNews client software (a newsreader) instead.
I recommend not to use Outlook Express, it is mindboggingly buggy.
I'm developing using ColdFusion 4.5 and a good deal of the
page processing depends on whether or not a control is defined. To
prevent users from clicking on a submit button more than once or
clicking on another submit button before the page has finished
processing I have decided to use javascript to disable all of the
submit buttons on the page.
This is the wrong approach because:
[...] this is preventing submission of the form
You need to revise the concept of your server-side application. It
must not accept input twice. Sessions are a good way to accomplish that.
<script language="JavaS cript">
<script type="text/javascript">
function fxnDisableBtn(f oo)
{
//alert(foo.type + ", " + foo.name + ", " + foo.value);
//document.frm1.f oo.click();
No. If you have a method that accesses forms, pass a
reference the HTMLFormElement object instead ("this.form"
in an event handler of a form control, "this" in an event
handler of the "form" element). This avoids code like
//document.frm1.s ubmit();
document.frm1.b tnSave.disabled = true;
document.frm1.b tnGoBack.disabl ed = true;
document.frm1.b tnReturn.disabl ed = true;
document.frm1.b tnForward.disab led = true;
//document.frm1.s ubmit();
//document.frm1.f oo.click();


and you could use

... foo.elements['btnSave'] ...

aso. instead. And remember not to make operation dependent on
client-side script support for it can be disabled or not even
present.
HTH

PointedEars
Jul 20 '05 #5
Unregistered wrote:
Is there no way to make the form submit after the button is disabled,
No, there is not.
I'm having exactly the same problem?


I do not know. Have you?
PointedEars
Jul 20 '05 #6
Unregistered wrote:
Is there no way to make the form submit after the button is disabled,
No, there is not.
I'm having exactly the same problem?


I do not know. Are you having it?
PointedEars
Jul 20 '05 #7

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

Similar topics

7
4674
by: Robert May | last post by:
I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application. However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements...
4
1157
by: Murphy | last post by:
As I understand the click event is initiated by JavaScript what happens in the event where a browser has disabled client side scripting or doesn't support it ? If writing a site is it better to avoid the click event and include all code in the "Load" event of the page ? Thanks Murphy
3
13105
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 disable the button in the OnClick event in ASP.Net because then the Click event won't post to the server (because you disabled it). I searched google groups, and there is a solution to this problem, but I didn't think it was clean enough and...
16
3462
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!
0
2663
by: comp.lang.php | last post by:
I have a form that when you click the "Generate Report" submit button, it will force download a CSV file, required for this project. On the very same page you also have a "Search" submit button, when you press it it should generate search results in a new page. However, when you click the "Generate Report" submit button, the moment you try to THEN click the "Search" submit button, the "Search" submit button NEVER goes to a new page but...
4
1608
by: Benny Ng | last post by:
Dear All, <input type="checkbox" name="chkAgreement" value="0">I agree with the above terms and conditions <asp:ImageButton ID="ImgBtnSubmit" Runat="server" CausesValidation=True ImageUrl="images/submit.gif" width="70" height="30"></asp:ImageButton>
5
2459
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 made the postback request.???" for e.g. I have a webpage default.aspx. I place TWO or more server buttons on it. Create server-side event handlers for each of the buttons.
6
3088
by: Oleg Konovalov | last post by:
Hi, I have a web application which is (among other things) doing large SQL Insert's, so sometimes it takes a while, user becomes impatient and clicks again (or just does double-click), so the same data is getting inserted again. I was thinking of some simple solution in Javascript.
2
2817
by: chrisp | last post by:
I have an ASP.NET 2 page with a button that causes a credit card transaction to be authorised. The authorisation procedure may take a few seconds and so I want to prevent the user from clicking the button again (or at least detect that an authorisation is already in progress and do nothing) while the first authorisation is in progress. Can someone help me out? I've tried the following but none of the solutions work: 1) Disabling the...
0
9546
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
10490
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
10030
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
6809
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
5467
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
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
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
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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.