I am learning JQuery, and I have checked out that JQUery has got a validation plugin. http://docs.jquery.com/Plugins/Validation#Validate_forms_like_you.27ve_never_been_validating_before.21
To use it, users have to include another script file in the Head tag in HTML.
I am thinking if this will cause any code collisions to the codes in the validation plugin
when more and more javascript files are included.
Should I use JQuery to write myself new customed functions for checking data input from users
or use the JQuery data validation plugin?
Please advise.
jQuery Validation is a javascript based plugin that helps you implement a powerful client side validator to your form elements that validate the value ( name, email, address, etc..) your user input when submitting.
Form validation is a process of confirming the relevant information entered by the user in the input field.
fn , so simply check whether it exists or not; if (typeof jQuery. fn. validationPlugin === "function") { // It's loaded } else { // It's not. }
UnobtrusiveJavaScriptEnabled" property value back to false and create a new file in "Scripts" folder and name it "script-custom-validator. js". Add the Jquery validator code in it as shown below i.e. The above piece of code attaches my account register form with jQuery form validator by using form ID.
I would use the validation plugin if you're doing anything complex, or a lot of anything. It's not that heavy and has matured quite a bit. If it's overkill don't use it, if it fits your needs then do, it's an excellent plugin.
Main reasons:
The collisions I wouldn't worry about, only if you choose to include another .validate()
plugin, but this is conscious choice with anything javascript really, not something to worry about I would think.
I would suggest using the plugin. Of course, you should never rely solely on client validation - you should still validate the post in your server code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With