This site contains the document for old version. Please upgrade to the latest version v1.0.0

vin validator

Validate an US VIN (Vehicle Identification Number)

Validators

Options

Option HTML attribute Type Description
message data-fv-vin-message String The error message
When setting options via HTML attributes, remember to enable the validator by setting data-fv-vin="true".
The message option can be updated on the fly via the updateMessage() method

Example

randomvin.com helps you generate a random vin for testing
<form id="vinForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-xs-3 control-label">VIN</label>
        <div class="col-xs-5">
            <input type="text" class="form-control" name="vin" />
        </div>
    </div>
</form>

<script>
$(document).ready(function() {
    $('#vinForm').formValidation({
        framework: 'bootstrap',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            vin: {
                validators: {
                    vin: {
                        message: 'The VIN number is not valid'
                    }
                }
            }
        }
    });
});
</script>
<form id="vinForm" 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">VIN</label>
        <div class="col-xs-5">
            <input type="text" class="form-control" name="vin"
                data-fv-vin="true"
                data-fv-vin-message="The value is not valid VIN" />
        </div>
    </div>
</form>

<script>
$(document).ready(function() {
    $('#vinForm').formValidation();
});
</script>