parsley.js


  • declarative form validation
  • less than 12k minified
  • configurable, simple, maintainable
  • easy to style inputs and errors
  • only depends on jQuery (or zepto)

the current state of affairs 


let's validate a simple form using jQuery-validate

jsFiddle

So what's wrong with that?!


Ship it!

problems with this method


  • 40k of weight to the payload
  • over 20 lines of JS to validate 2 fields
  • markup and validation disconnected
  • ok, I added a field, now what?
  • does not scale well


Now imagine doing that for dozens of pages
and hundreds of individual fields!


No seriously... think about it.

There's a better way!


What if we could declare our validation config
in our markup?  We could take one look at the
form and know everything we need.

jsFiddle

Why is this better?


  • validation config built into markup
  • easy to add fields and validation
  • very maintainable for large sites

Downsides?


The only real downside I've found with parsley
is that, in the beginning, complex features
require a bit more API research and
forethought before a good solution is found.

However I have yet to find a case that can
not be elegantly addressed with parsley.

jsFiddle

WINNING!

Once you get used to how parsley approaches
validation, you will find that it offers a very robust
way to address any situation you come across.

questions?



Made with Slides.com