Examples

A collection of usage examples you can play with

Basic

Advance

Integrating with server side

This guide demonstrates integrating BootstrapValidator with the server side:

Compatibility

In order to make BootstrapValidator work together with other plugin, you should follow two rules below:

1 — Don't exclude the field if the plugin changes the field visibility

Some plugins hide your field and create new elements to change how the field looks like. By default, the hidden, invisible fields will not be validated. Therefore, you need to set excluded: ':disabled'. See the excluded option for more information.

Example: Bootstrap Button

2 — Revalidate the field if the plugin changes its value dynamically:

Most plugins trigger an event after changing the field value. By using this kind of event handler, you need to ask BootstrapValidator to revalidate the field.

$(field)
    .nameOfPlugin(pluginOptions)
    .on(pluginChangedEvent, function() {
        $(form)
            .data('bootstrapValidator')             // Get the validator instance
            .revalidateField(field);                // Revalidate it

        // It is equivalent to use
        $(form).bootstrapValidator('revalidateField', field);
    });

Look at the revalidateField() method for more details.

Example: Chosen

These examples show how you can use BootstrapValidator with other Javascript plugins.

More examples that are demonstrated in other pages: