Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Javascript brakes required validation
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Javascript brakes required validation
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01610769
Message ID:
01610769
Vues:
38
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.
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform