Disable Button Causes Weird Effecthttp://forums.asp.net/t/1732056.aspx/1?Disable+Button+Causes+Weird+EffectWed, 19 Oct 2011 23:19:50 -040017320564646221http://forums.asp.net/p/1732056/4646221.aspx/1?Disable+Button+Causes+Weird+EffectDisable Button Causes Weird Effect <p>I am using this thread: <a href="../../../../t/1099598.aspx">http://forums.asp.net/t/1099598.aspx</a></p> <p>I took the code</p> <pre class="prettyprint">Button1.Attributes.Add(&quot;onclick&quot;, &quot;javascript:&quot; &#43; Button1.ClientID &#43; &quot;.disabled=true;&quot; &#43; ClientScript.GetPostBackEventReference(Button1,&quot;&quot;));</pre> <p>My web page uses a contact from. I want to disable the send button after they click it so that they can't spam my inbox. I am using the&nbsp;RequiredFieldValidator controls on my page. also have some backend validation code that displays the errors in a summary box, in case the user has disabled JavaScript.</p> <p>Right now my form works correctly. When I click the send button with errors on the form the RequiredFieldValidators display on the page. The summary doesn't display (probably because the page hasn't been submitted to the server yet. The errors were found on the client-side.)</p> <p>Now, when I add that line of code above to my web page. I click the form with errors on it, and both my RequiredFieldValidators AND my server validation summary control both show up at the same time. The send button gets disabled, but it appears that this line forces the server to run my validation as well...</p> <p>I'm just confused why this happens.. I'm not really sure how that line works. I'm thinking that it forces the page to post to the server and get loaded back every time the button is clicked.</p> 2011-10-19T23:19:50-04:00