garygreen / dominar

Lightweight bootstrap validator inspired by Laravel
http://garygreen.github.io/dominar/
22 stars 4 forks source link

Add support for adding basic validation by attributes #14

Open garygreen opened 9 years ago

garygreen commented 9 years ago

Might be a good idea?

<input type="text" name="username" data-dominar="required|alpha">
stocksp commented 9 years ago

I'm sure there are folks who would like it.... not me! I really liked REMOVING all the markup when I moved from brand x to Dominar.

garygreen commented 9 years ago

I somewhat agree, as I don't like libraries like parsley.js or others that promote putting a lot of validation logic in the elements themselves, but because dominar is so terse in specifying rules it can sometimes be quicker to specify them in-line and still look clean. A lot of people like doing it as well, so I wouldn't want to put those guys off using dominar.

With that said, it's pretty easy to support this yourself with some custom code (or I may make it optional inclusion at some point, dominar-inline.js or something).