Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
Want to know how $('#myelement').valid(); function works , I mean what does it validate, what rules what messages etc . Where are those rules configured.

Thanks
Regards
Chandrashekhar Rai
Posted

Hi,

For information on the jQuery validation plugin, have a look at the jQuery Validation Plugin Documentation[^].

From the documentation:
.valid()

Description: Checks whether the selected form is valid or whether all selected elements are valid.


... hope it helps
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Sep-15 9:54am    
5ed.
—SA
hypermellow 9-Sep-15 9:59am    
Thanks SA :-)
Sergey Alexandrovich Kryukov 9-Sep-15 10:02am    
I added a serious security warning in Solution 3.
—SA
In addition to Solutions 1-2:

I hope you will succeed in validation on the client part. But if you reasonably use some form and validated it, you should submit the form data to the server side, otherwise the use of the forms makes little to no sense. But then you need to understand that client-side validation is absolutely insufficient if security is an issue. In case when security can be possibly compromised by the client data, the malicious artist can easily, very easily bypass your validation.

So, you always need to validate/sanitize such data on server side. I explained what can happen in real life if you fail to do so, on just one real-life example, in my past answer: unable to send mail , it showing the error in below code .[^].

Please consider it as a serious security warning.

—SA
 
Share this answer
 
Comments
Peter Leow 9-Sep-15 10:11am    
Good advice. 5ed!
Sergey Alexandrovich Kryukov 9-Sep-15 10:13am    
Thank you, Peter.
—SA
hypermellow 9-Sep-15 10:35am    
Good solid advice ... a 5 from me too!
Sergey Alexandrovich Kryukov 9-Sep-15 10:39am    
Thank you very much.
—SA
It is a jQuery plugin[^] that
Quote:
Checks whether the selected form is valid or whether all selected elements are valid.

Check out this video on an overview of how it works[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Sep-15 10:02am    
5ed. I added a serious security warning in Solution 3.
—SA
Peter Leow 9-Sep-15 10:12am    
Thank you, Sergey.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900