tags:

views:

80

answers:

3

Hi all,

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.

+2  A: 

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.

Nick Craver
A: 

I would give the plugin a try first, see if it meets your needs. I'd be very surprised if you have a problem with it conflicting with other libraries/scripts. The reason for this is because the plugin creates a closure by defining their functions and variables inside an anonymous function, so there won't be any collisions with other scripts on your page and globals won't get clobbered or any bad thing like that.

On a side note, you should also be validating on the server too.

wsanville
+1  A: 

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.

BradBrening