Reputation: 165
friends am started to doing bootstrap validation by taking reference from http://formvalidation.io/examples/changing-success-error-colors/
At the end of the page there is a download option. When I click download they told use something like foundation, pure, semantic and ui kit.
I want to do exactly what they have done - can anyone explain how to do that?
Here is my fiddle https://jsfiddle.net/0s9xw5rx/2/
Css:
.field-error .control-label,
.field-error .help-block,
.field-error .form-control-feedback {
color: #ff0039;
}
.field-success .control-label,
.field-success .help-block,
.field-success .form-control-feedback {
color: #2780e3;
}
HTML
<form id="loginForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-3 control-label">Username</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="username" />
</div>
</div>
<div class="form-group">
<label class="col-xs-3 control-label">Password</label>
<div class="col-xs-5">
<input type="password" class="form-control" name="password" />
</div>
</div>
<div class="form-group">
<div class="col-xs-9 col-xs-offset-3">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</div>
</form>
Script
$(document).ready(function() {
$('#loginForm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
row: {
valid: 'field-success',
invalid: 'field-error'
},
fields: {
username: {
validators: {
notEmpty: {
message: 'The username is required'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_\.]+$/,
message: 'The username can only consist of alphabetical, number, dot and underscore'
}
}
},
password: {
validators: {
notEmpty: {
message: 'The password is required'
}
}
}
}
});
});
Upvotes: 0
Views: 159
Reputation: 747
your question is too open and unclear. Formvalidtion.io is a library to validate forms for framework users. it means if I'm using Bootstrap/Foundation... i can use the framework's Forms design and behavior with this library.
please answer the following question so we can help you:
Upvotes: 1