Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access isvalid property of ASP.NET validators in Javascript

I have read here that any ASP.NET validator has a property called: isvalid. This property can be used in client side to check if the validator successfully passed the validation or not.

I tried to access this property as following but for some reason the code fail:

alert(document.getElementById("validator_clientID").isvalid);

Do you have any idea why this is not working?

like image 209
mohammedn Avatar asked Sep 26 '09 13:09

mohammedn


People also ask

How do you check if a website is valid in JavaScript?

Page_ClientValidate() will work. It returns true if the page was valid and it works fine. If you are using ASP.NET 2.0, pass the validation group name as a parameter.

What is IsValid C#?

IsValid(Object)Determines whether the specified value of the object is valid.

How validators are used in Net What are various types of validators?

ASP.NET validation controls validate the user input data to ensure that useless, unauthenticated, or contradictory data don't get stored. ASP.NET provides the following validation controls: RequiredFieldValidator. RangeValidator.


1 Answers

I found same !

try this document.getElementById('XXX').Validators[0].isvalid It's working for me

like image 74
Sylar_ Avatar answered Oct 05 '22 19:10

Sylar_