programer.tips, another cool thing from @nghuuphuoc!

imo validator

Validate an IMO (International Maritime Organization)

Validators

Improve it on Github

Options

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

Example

IMO Result
IMO 9074729
imo 9074729
9074729
IMO 9074728
<form id="imoForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label">IMO</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" name="imo" />
        </div>
    </div>
</form>
$(document).ready(function() {
    $('#imoForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            imo: {
                validators: {
                    imo: {
                        message: 'The value is not valid IMO'
                    }
                }
            }
        }
    });
});