Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it good to use JQuery's validation plugin?

Tags:

jquery

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.

like image 702
user327712 Avatar asked May 16 '10 19:05

user327712


People also ask

What is Javascript validation plugin?

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.

What is jQuery validate used for?

Form validation is a process of confirming the relevant information entered by the user in the input field.

How do you check if jQuery validate is working?

fn , so simply check whether it exists or not; if (typeof jQuery. fn. validationPlugin === "function") { // It's loaded } else { // It's not. }

How we can use jQuery validation plugins in MVC?

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.


2 Answers

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:

  • There are a lot of options
  • There's a lot of community support/examples available to help.
  • Depending on your server-side framework, there are lots of them that already have an integration with this in some way.
  • It's already CDN hosted

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.

like image 175
Nick Craver Avatar answered Oct 11 '22 04:10

Nick Craver


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.

like image 2
BradBrening Avatar answered Oct 11 '22 04:10

BradBrening