Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button with OnClick not submitting in IE8

Status
Not open for further replies.

joshbula

Technical User
Nov 19, 2004
45
0
0
US
(note, I originally posted this in the ASP.NET forum, but haven't received any replies, so I'm trying here as well)

Hello,

I have two buttons, one is a submit button. When the submit button is clicked, both buttons disappear and a third button that is disabled with the text "Submitting..." is displayed.

It works fine almost all the time on almost all browsers, but for 1 user in about 200 people who try it, I get a call that nothing happens when they click the Submit button. They are all Internet Explorer 8 users.

What could possibly be causing this?

I'm using ASP.Net with VB. This is the ASP.Net code for the buttons:
Code:
 <asp:Button ID="btnGoBack" runat="server" Text="Go Back and Make Changes" />&nbsp;
<asp:Button ID="btnSubmitPayment" runat="server" Text="Submit Payment" UseSubmitBehavior="false" />
<asp:Button ID="btnSubmitting" runat="server" Text="Submitting..." Enabled="false" Style="visibility: hidden;" />

And here is the VB code-behind that adds the OnClick:
Code:
 If Not Page.IsPostBack Then
            btnSubmitPayment.OnClientClick = String.Format("javascript:{0}.style.visibility = 'hidden';{0}.style.display = 'none';{1}.style.visibility = 'visible';{2}.style.visibility = 'hidden';{2}.style.display = 'none';", btnSubmitPayment.ClientID, btnSubmitting.ClientID, btnGoBack.ClientID)
End If

Here is the Source Code that .NET generates and sends to the browser:

Code:
<input type="submit" name="ctl00$ContentPlaceHolder1$btnGoBack" value="Go Back and Make Changes" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$btnGoBack&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_ContentPlaceHolder1_btnGoBack" />&nbsp;
                    <input type="button" name="ctl00$ContentPlaceHolder1$btnSubmitPayment" value="Submit Payment" onclick="javascript:ctl00_ContentPlaceHolder1_btnSubmitPayment.style.visibility = 'hidden';ctl00_ContentPlaceHolder1_btnSubmitPayment.style.display = 'none';ctl00_ContentPlaceHolder1_btnSubmitting.style.visibility = 'visible';ctl00_ContentPlaceHolder1_btnGoBack.style.visibility = 'hidden';ctl00_ContentPlaceHolder1_btnGoBack.style.display = 'none';WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$btnSubmitPayment&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" id="ctl00_ContentPlaceHolder1_btnSubmitPayment" />
                    <input type="submit" name="ctl00$ContentPlaceHolder1$btnSubmitting" value="Submitting..." id="ctl00_ContentPlaceHolder1_btnSubmitting" disabled="disabled" style="visibility: hidden;" />
I have also tried just a simple OnClick="this.disabled = true; this.value = 'Submitting...';" but that was giving a few people problems also.


Doctype:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]

All the <script> tags are type "text/javascript"

Any help or insight into this problem would be greatly appreciated.

Thanks,
Josh
 
Is it possible that 1 in 200 of your users has JS disabled, and so your onclick isn't working as you expect, and the default fall-back onto the standard submit button also doesn't work as you expect?

That aside, why are you switching in a button that is disabled? Why not simply detect multiple posts server-side, which means you won't have to disable any buttons which in theory means you won't get this problem?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
I figured it out... totally unrelated to any of this, but rather a small stupid mistake I made when I changed some other stuff. It validates the card expiration date server-side but the error message wasn't displaying.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top