Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Javascript brakes required validation
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
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:
01610791
Vues:
24
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform