isbn validator
Validate an ISBN (International Standard Book Number). Support both ISBN 10 and ISBN 13
Options
Option | HTML attribute | Type | Description |
---|---|---|---|
message |
data-fv-isbn-message |
String | The error message |
When setting options via HTML attributes, remember to
enable the validator by setting data-fv-isbn="true".
The message option can be updated on the fly via the
updateMessage() method
Example
ISBN | Result |
---|---|
9971502100 | |
99921-58-10-7 | |
960 425 059 0 | |
99921-58-10-6 | |
9780306406157 | |
978-0-306-40615-7 | |
978 0 306 40615 7 | |
978-0-306-40615-6 |
<form id="isbnForm" class="form-horizontal">
<div class="form-group">
<label class="col-xs-3 control-label">ISBN</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="isbn" />
</div>
</div>
</form>
<script>
$(document).ready(function() {
$('#isbnForm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
isbn: {
validators: {
isbn: {
message: 'The value is not valid ISBN'
}
}
}
}
});
});
</script>
<form id="isbnForm" class="form-horizontal"
data-fv-framework="bootstrap"
data-fv-icon-valid="glyphicon glyphicon-ok"
data-fv-icon-invalid="glyphicon glyphicon-remove"
data-fv-icon-validating="glyphicon glyphicon-refresh">
<div class="form-group">
<label class="col-xs-3 control-label">ISBN</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="isbn"
data-fv-isbn="true"
data-fv-isbn-message="The value is not valid ISBN" />
</div>
</div>
</form>
<script>
$(document).ready(function() {
$('#isbnForm').formValidation();
});
</script>
Related validators
The following validators might be useful to you: