I want to write a plugin to validate forms. I have made detailed research about that but I want to write it with my own way. I dont want to write so many lines of code when using the library. It should be easy to use.
I found a jQuery library for validation. It uses HTML classes. For example if you want to a field with presence validation you just add the field required class done but I am not sure this is this is clear way. So I am confused with this, so anyone can tell me which is the best way to write a form validation library?
Actually the I found the jQuery validation plugin way is a very nice of dealing with validation logic. Here are some my reasons for it..
markup on your form elements.
replacing one with a better one
should be relatively simple
same validation logic and chance of
missing is rare (all date elements
will get same date logic, although
you can easily override)
extra logic and same UI look and feel
(obvious) too and you are sure that
they all behave the same. (I add a
jquery rule to make all date elements
has a date picker too)
relatively easy with out change to
your markup.