programer.tips, another cool thing from @nghuuphuoc!

vin validator

Validate an US VIN (Vehicle Identification Number)

Validators

Improve it on Github

Options

Option HTML attribute Type Description
message data-bv-vin-message String The error message
When setting options via HTML attributes, remember to enable the validator by setting data-bv-vin="true".

Example

randomvin.com helps you generate a random vin for testing
VIN Result
1FAHP26W49G252740
2FTRX07W53C371582
WP0CA29863U153381
JTMKF4DV5B5309254
<form id="vinForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label">VIN</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" name="vin" />
        </div>
    </div>
</form>
$(document).ready(function() {
    $('#vinForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            vin: {
                validators: {
                    vin: {
                        message: 'The VIN number is not valid'
                    }
                }
            }
        }
    });
});