Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Disable Submit Button

Reply
Thread Tools

Disable Submit Button

 
 
Jeff
Guest
Posts: n/a
 
      10-18-2004
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 WebControls.Button
In the Page_Load event I attach an "onclick" javascript event handler to
disable the submit button.

i.e. btnSubmit.Attributes.Add("onclick", "document.Form1.btnSubmit.disabled
= true; return true;")

The problem with this is once the button is disable the form will not
submit. If I change it to the following it will work, however, the button
will not be disabled.

i.e. btnSubmit.Attributes.Add("onclick", "document.Form1.btnSubmit.disabled
= false; return true;")

Any ideas on how to accomplish this?

Thanks!


 
Reply With Quote
 
 
 
 
David Wier
Guest
Posts: n/a
 
      10-18-2004
Check out this, in the Tips & Tricks section of http://aspnet101.com:
http://aspnet101.com/aspnet101/tips.aspx?id=81

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com


"Jeff" <(E-Mail Removed)> wrote in message
news:Osd$A%(E-Mail Removed)...
> 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 WebControls.Button
> In the Page_Load event I attach an "onclick" javascript event handler to
> disable the submit button.
>
> i.e. btnSubmit.Attributes.Add("onclick",

"document.Form1.btnSubmit.disabled
> = true; return true;")
>
> The problem with this is once the button is disable the form will not
> submit. If I change it to the following it will work, however, the button
> will not be disabled.
>
> i.e. btnSubmit.Attributes.Add("onclick",

"document.Form1.btnSubmit.disabled
> = false; return true;")
>
> Any ideas on how to accomplish this?
>
> Thanks!
>
>



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      10-18-2004
btnSubmit.Attributes.Add("onclick",
"window.setTimeout('document.Form1.btnSubmit.disab led= true;',10);");

but this recommend. the submit fails (post lost on internet), the user can
not refire it. if they hit refresh, the button will be enabled. you should
store a transaction guid in a hidden field and tack that it has been
processed. you should also code for two running at the same time.

-- bruce (sqlwork.com)


"Jeff" <(E-Mail Removed)> wrote in message
news:Osd$A%(E-Mail Removed)...
> 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 WebControls.Button
> In the Page_Load event I attach an "onclick" javascript event handler to
> disable the submit button.
>
> i.e. btnSubmit.Attributes.Add("onclick",

"document.Form1.btnSubmit.disabled
> = true; return true;")
>
> The problem with this is once the button is disable the form will not
> submit. If I change it to the following it will work, however, the button
> will not be disabled.
>
> i.e. btnSubmit.Attributes.Add("onclick",

"document.Form1.btnSubmit.disabled
> = false; return true;")
>
> Any ideas on how to accomplish this?
>
> Thanks!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM
If value in name field in top row disable submit button until add button is pressed or field is cleared. Chuck Javascript 0 11-10-2003 02:23 AM
Disable Submit Button until Accept Terms and Redirect Page on Submit Paul Oakfleet Javascript 1 09-10-2003 06:07 PM



Advertisments