VanadiumJS / JS form validation

Posted on 07 Dec 2009. in links javascript

VanadiumJS offers pretty slick JavaScript form validation. It allows you to specify how to validate an input field using the field’s CSS class:

    <input class=":integer" type="text"/>
    <input class=":min_length;4 :max_length;8" type="text"/>
    <input class=":required" id="password" type="password"/>
    <input class=":same_as;password" type="password"/>

It pains me to see class co-opted so, but I love the idea behind this. It also supports hooks for triggering AJAX server-side validation:

    <input id="username" class=":ajax;/user/check_username.json" type="text"/>

… and the server just response with some simple JSON.