Sha256: ad7d9fc12b95055bb68e9fc8ed55f5d42e38ec031141390874faecf4550acf75

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

bootstrap-validator-rails (0.5.1)
=================================

Gem version of bootstrapvalidator JavaScript library = a jQuery based field validator for Twitter Bootstrap 3.

**Source:** https://github.com/nghuuphuoc/bootstrapvalidator

### How to Use

**Add into your Gemfile**

`gem 'bootstrap-validator-rails'`

**Add into your application.js**

`//= require bootstrapValidator.min`

**Add into your application.css**

`*= require bootstrapValidator.min`

**In your Rails directory run**

`bundle install`

### Together with Rails remote form

To use bootstrapValidator in a Rails remote form, you have to initialize the form validator like this:

```javascript
$(form)
    .bootstrapValidator({
        ...
    })
    .on('success.form.bv', function(e) {
        // Called when the form is valid
        
        var $form = $(e.target);
        if ($form.data('remote') && $.rails !== undefined) {
            e.preventDefault();
        }
    });
```

Reference:
* [success.form.bv](http://bootstrapvalidator.com/settings/#event-form) event

If you don't, your form will be submitted two times.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap-validator-rails-0.5.2 README.md
bootstrap-validator-rails-0.5.1 README.md