A JQuery validation plugin: practical, simple and extensible. Validates your existing forms in HTML without headaches. Developed by Corollarium.
Licensed under the MIT license.
Some ideas and code borrowed from jquery-validate.
Include jQuery and Validarium. Then apply Validarium to the form.
<form>
....
</form>
<script src="jquery.js"></script>
<script src="jquery.validarium.js"></script>
<script>
$(document).ready(function() {
$("form").validarium();
});
</script>
You can download the package, clone the repository or use bower.
bower install
See https://github.com/Corollarium/validarium/wiki
<form>
<input type="text" data-rules-required="true" />
</form>
This works for all the other items, too
<form>
<input type="text" data-rules-required="true" data-rules-required-message="My message here" />
</form>
<form>
<input type="text" data-rules-minlength="5" data-rules-maxlength="10" />
</form>
(note that minlength accepts empty values, if you don't want those use the "required" rule)
<form>
<input type="password" id="pw1" data-rules-equalto="#pw2"/>
<input type="password" id="pw2" data-rules-equalto="#pw1"/>
</form>
<form>
<input type="text" data-rules-regexp="^([a-zA-Z]{5})$" />
</form>
<form>
<input type="text" data-rules-min="4" data-rules-max="10" data-rules-number="true" />
</form>
<form>
<input type="text" data-rules-min="4" data-rules-max="10" data-rules-digits="true" />
</form>
<form>
<input type="text" data-rules-minlength="4" data-rules-maxlength="10" />
</form>
<form>
<input type="text" name="someurl" data-rules-url="true" />
<input type="text" name="someemail" data-rules-email="true" />
<input type="text" name="somedomain" data-rules-domain="true" />
</form>
<form>
<input type="text" name="customer-cpf" data-rules-cpf="true" />
<input type="text" name="customer-cnpj" data-rules-cnpj="true" />
</form>
Copyright (c) 2012 Corollarium Tecnologia http://www.corollarium.com Licensed under the MIT license.