Check if a string is a lower or upper case one.
Option | Equivalent HTML attribute | Type | Default | Description |
---|---|---|---|---|
message |
data-bv-stringcase-message |
String | n/a | The error message |
case |
data-bv-stringcase-case |
String | lower |
Can be lower , upper |
The following form asks user to enter a credit card holder in uppercase:
<form id="cardHolderForm" class="form-horizontal">
<div class="form-group">
<label class="col-lg-4 control-label">Credit card holder</label>
<div class="col-lg-4">
<input type="text" class="form-control" name="name" />
</div>
</div>
</form>
<script>
$(document).ready(function() {
$('#cardHolderForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
name: {
validators: {
// Since case is a Javascript keyword,
// you should place it between quotes (like 'case' or "case")
// to make it work in all browsers
stringCase: {
message: 'The card holder must be in uppercase',
'case': 'upper'
}
}
}
}
});
});
</script>
Comments
If you want to report a bug, please submit the issue on Github. Do NOT post the issue here.
For a general question or feedback, use the form below.