>Hi,
>
>I need help in changing the following Javascript. First a little background to the question.
>
>In order to prevent user from clicking on Submit button twice (when there is a moment delay in processing the page) I added the following code to the Page_Load method of the page:
>
>
>Submit.Attributes.Add("onclick", " this.disabled = true; " + ClientScript.GetPostBackEventReference(Submit, null) + ";");
>
>
>But what happens is, on Submit click, the Submit button becomes disabled but the page gets processed, even when several asp:requiredfieldvalidator validation fail (that is, user leaves the fields empty).
>
>When I change the above code to
>
>Submit.Attributes.Add("onclick", " this.disabled = true; "
>
>
>the requiredfield validation works. That is, the page is not processed. But at the same time the Submit button is disabled. So user cannot click on Submit again, after filling required fields.
>
>So I need to change the Javascript code such that the Submit button is disabled ONLY when all asp:requiredfieldvalidator are validated ok. But I don't know how. Any suggestions? TIA.
Why not
Add("onclick", "return ProcessRequest(this);")
and add the necessary code in separate function?
If it's not broken, fix it until it is.
My Blog