Demo
Try entering data in the following form and try to submit it with invalid fields.
HTML
<form action="" method="post" id="contact-form">
<div>
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div>
<label for="email">E-mail</label>
<input type="text" name="email" id="email" />
</div>
<div>
<label for="message">Message</label>
<input type="text" name="message" id="message" />
</div>
<div>
<label for="subject">Subject</label>, select all applicable (use ctrl or cmd to select many)
<select name="subject" multiple="multiple" size="3">
<option value="question">Question</option>
<option value="suggestion">Suggestion</option>
<option value="bug">Bug</option>
</select>
</div>
<div>
<input type="submit" value="Send" />
</div>
</form>
Javascript
$(function() {
var v = $("#contact-form").jcheck();
v.validates("name", "message", {presence: true});
v.validates("email", {format: {"with": "email", message: "is not a valid email"}});
v.validates("message", {length: {minimum: 20, maximum: 255}});
v.validates("subject", {length: {minimum: 1, message: "must have a least %{count} select"}});
});
This is just a little taste of what you can do with jCheck, please check the documentation for more examples and explanations of how to do your client side validations with jCheck.