Validation framework for Bootstrap, from Twitter [http://twitter.github.com/bootstrap/index.html]
- This is a very simple and powerful validation framework for bootstrap.
-
Html: use the following code for your html form, it explains the custom attributes to be used for the validation section, required, data-type validation etc.
<form id="todo-form" onSubmit="return subCommonForm(0, 'main')" class="form-horizontal" action="action" method="POST">
<fieldset> <legend>formTitle</legend> <div id="genMsg" style="display:none;" class="alert alert-error"></div> <div class="control-group"> <label for="email" class="control-label">User Name</label> <div class="controls"> <input type="text" class="span6" placeholder="enter email" req="true" valsection="main" valdata="email" name="email" value=""/> <span class="help-inline">Email of the user</span> </div> </div> <div class="control-group"> <label for="login" class="control-label">User Name</label> <div class="controls"> <input type="text" class="span6" placeholder="enter login" req="true" valsection="main" name="login" value=""/> <span class="help-inline">User name for the user</span> </div> </div> <div class="control-group"> <label for="password" class="control-label">Password</label> <div class="controls"> <input type="password" class="span6" placeholder="enter password" req="true" valsection="main" name="password" value=""/> <span class="help-inline">Password for the user</span> </div> </div> <div class="control-group"> <label for="confirmPassword" class="control-label">Confirm Password</label> <div class="controls"> <input type="password" class="span6" placeholder="enter password" req="true" valsection="main" name="confirmPassword" value=""/> <span class="help-inline">Confirm password for the user</span> </div> </div> <div class="control-group"> <label for="firstName" class="control-label">First Name</label> <div class="controls"> <input type="text" class="span6" placeholder="enter first name" req="true" valsection="main" valdata="alpha" name="firstName" value=""/> <span class="help-inline">First name of the user</span> </div> </div> <div class="control-group"> <label for="lastName" class="control-label">Last Name</label> <div class="controls"> <input type="text" class="span6" placeholder="enter last name" req="true" valsection="main" valdata="alpha" name="lastName" value=""/> <span class="help-inline">Last name of the user</span> </div> </div> <div class="form-actions"> <input type="submit" class="btn btn-primary" value="Submit"/> </div> </fieldset> </form>
- Download bootstrap-validate.js and use it along with JQuery.
- Please try to contribute for the data-type validation and pending Html From controls with your valuable expertise.
- Email: sushskulkarni[at]gmail[.]com
- Tweet: [at]sushskulkarni