Skip to content

PascaleBeier/bootstrap-validate

Repository files navigation

bootstrap-validate

GitHub Workflow Status Lint GitHub Workflow Status Lint GitHub release (latest SemVer) npm GitHub

A simple Form Validation Utility for Bootstrap 3, Bootstrap 4 for Humans.

Demo

Supported Versions

bootstrap-validate Version Bootstrap Version Documentation
v1 Bootstrap 3 v1 Download + Docs
v2 Bootstrap 4 v2 Download + Docs

Documentation

Read the Documentation at bootstrap-validate.js.org.

Quick Start

$ npm i bootstrap-validate

Include the bootstrap-validate.js script:

<script defer="defer" src="bootstrap-validate.js"></script>

We want the #name to be not longer than 30 characters!

<div class="form-group">
    <label class="control-label">Enter a Name</label>
    <input id="name">
</div>

<script>
bootstrapValidate('#name', 'max:30:Your name must not be longer than 30 characters');
</script>

Validating an #email address couldn't be easier!

<div class="form-group">
  <label for="email" class="control-label">Enter your E-Mail</label>
  <input class="input" id="email">
</div>

<script>
bootstrapValidate('#email', 'email:Enter a valid email address');
</script>

More Features!

See the v2 Documentation on https://bootstrap-validate.js.org/v2/ to see all available validation features, examples, and usage with module bundlers.

Examples

See examples/ for real-world usage.

Download

You can find current Releases under Releases and older Releases for Bootstrap 3 and Bootstrap 4 in the Download Archive.

Changelog

See CHANGELOG.

Tests

Validation Rules are at least unit-tested. Use npm test to spin up the test suites.

License

Licensed under the MIT License, see LICENSE.