v0.5.3 is released on 2014.11.05!
Options
Option | HTML attribute | Type | Description |
---|---|---|---|
case |
data-bv-stringcase-case |
String | Can be lower default or upper |
message |
data-bv-stringcase-message |
String | The error message |
When setting options via HTML attributes, remember to enable the validator by setting data-bv-stringcase="true".
Example
The following form asks user to enter a credit card holder in uppercase:
<form id="stringCaseForm" class="form-horizontal">
<div class="form-group">
<label class="col-sm-4 control-label">Credit card holder</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="name" />
</div>
</div>
</form>
$(document).ready(function() {
$('#stringCaseForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
name: {
validators: {
stringCase: {
message: 'The card holder must be in uppercase',
'case': 'upper'
}
}
}
}
});
});