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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button with OnClientClick Not Submitting in IE8

Status
Not open for further replies.

joshbula

Technical User
Nov 19, 2004
45
US
Hello,

I have two buttons, one is a submit button. When the submit button is clicked, both buttons visibility = false 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;" />
(I've tried with and without the "UseSubmitBehavior", and if I add an OnClick="btnSubmitPayment_Click" is submits twice)


And here is the 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 it 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 OnClientClick ="this.disabled = true; this.value = 'Submitting...';" but that was giving a few people problems also.

The only other thing I can think of is maybe the Verisign code is conflicing with it somehow?

Code:
 <script type="text/javascript" src="[URL unfurl="true"]https://seal.verisign.com/getseal?host_name=xxxxxxx.xxx&amp;size=L&amp;use_flash=YES&amp;use_transparent=YES&amp;lang=en"></script>[/URL]
Any suggestions would be greatly appreciated... it's so frustrating because it works fine for 99% of the people who try it, so it's almost impossible to troubleshoot.

Thanks!
 
I suggest remotely accessing that one user's desktop, enabling the javascript debugger on the IE8, and starting figuring it out.

I am surprised that you reference the object by using its ID directly. Maybe it works in IE. I always use:

document.getElementById(id)
 
I think I figured it out--stupid mistake I made when I changed the page to use a confirmation panel rather than submitting right from the panel with the credit card textboxes... Expired credit card dates were causing the server-side validation to prevent the submission but no error message was being displayed because the label that displays the error message was still on the credit card panel which was now hidden. I changed the validation to not even let it leave that credit card panel if the card is expired, and all has been good so far.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top