>>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?
I would try your suggestion but I found a code in a blog that seems to be solving the problem. I am testing it now.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham