Questions tagged [bootstrapvalidator]

BootstrapValidator is the jQuery plugin to validate form fields, designed to use with Bootstrap 3, developed by nghuuphuoc

The BootstrapValidator plugin is a plugin by nghuuphuoc. Its purpose is to perform client-side form fields validation of user entered data specifically designed to use with framework.

Useful Links:


Stack Snippet Starter Pack:

HTML - Include the plugin script someplace after the jQuery and Bootstrap library(s):
(Use CDN links or host the scripts yourself)

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css"/>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.css"/>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.js"></script>

<form id="Form" class="form-horizontal">
    <div class="form-group">
        <label class="col-md-3 control-label">Full name</label>
        <div class="col-md-4">
            <input type="text" class="form-control" name="fullName" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-3 control-label">Email address</label>
        <div class="col-md-6">
            <input type="text" class="form-control" name="email" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-3 col-md-8">
            <button type="submit" class="btn btn-primary">Submit</button>
        </div>
    </div>
</form>
$(document).ready(function() { //<-- ensure form's HTML is ready
    $('#Form').bootstrapValidator({ //<-- initialize plugin on the form.
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            fullName: { // <-- this is the name attribute, NOT id
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
                    }
                }
            },
            email: {
                validators: {
                    notEmpty: {
                        message: 'The email is required and cannot be empty'
                    },
                    emailAddress: {
                        message: 'The input is not a valid email address'
                    }
                }
            }
        }
    });
});

jsFiddle Demo: http://jsfiddle.net/5hfyd40x/

API: http://bv.doc.javake.cn/api/

Develop new validator: http://bv.doc.javake.cn/developing/


179 questions
10
votes
2 answers

Validate password and confirm password fields using bootstrap validator

I have stuck with adding and removing the bootstrap validator class through Jquery. I am adding validation if div is visible and remove if div is hidden. Here is my try:
Sachin I
  • 1,500
  • 3
  • 10
  • 29
10
votes
2 answers

How to call validation on a button click event thats not a submit type but a button type and without a form?

I have been trying to figure this out, I know validation can be fired within a form as long as the button is of type submit. But I have a few other tabs on the view and when I use submit, it causes a posback and goes back to the first tab. I don't…
Chris
  • 2,953
  • 10
  • 48
  • 118
9
votes
4 answers

Why does my submit button gets re-enabled before all fields are filled in?

I'm using the code below to validate (through bootstrap-validator) the content of each field in my contact form (there's also an extra check via google recaptcha). You can see and test the form at at this address. By default, the submit button is…
Greg
  • 3,025
  • 13
  • 58
  • 106
8
votes
3 answers

TypeError: $(...).bootstrapValidator is not a function , it does load the ContactUs.js file, but it's not able to find the function

As the Code is given and it is not able to find the function. I have tried several changes but still get the Error the sequence is also correct. The head part is at the top script and the other environment development is at the bottom of the code…
Shahzeb
  • 95
  • 1
  • 1
  • 8
6
votes
3 answers

Bootstrap form with modal, validator and email

I'm trying to make an html page with bootstrap and bootstrap validator. What i want to do : When the user click on the button, a modal appear with a form. After validation, form sent an email with the fields value. When the mail was correctly sent,…
5
votes
1 answer

Using Bootstrap Validator. How does it handle radio button validation?

I am using Bootstrap Validator. I am unclear on how to use it to validate selection of a radio button. Can someone please clarify?
dugla
  • 12,774
  • 26
  • 88
  • 136
5
votes
1 answer

form submitting twice via ajax POST

Inserting into mysql using php file called via AJAX. Before insert statement php code performs select query to find duplicate records and continue to insert statement. Issue: When calling php file from ajax. it executed twice and getting response…
5
votes
3 answers

BootstrapValidator, validate fields added dynamically to the form

I'm searching for a way to validate fields that I add to a form after the DOM is loaded and $('#formId').bootstrapValidator() is executed. Is there a way to add a new field and validate it when the form is submited?
Jairo
  • 131
  • 1
  • 11
4
votes
1 answer

How to make validation work on Bootstrap v4 with Bootstrap validator?

I just migrated to Bootstrap v4 from v3. And Bootstrap Validator is partially working. The JavaScript part still function. However, the styling is gone. this is the bootstrap validator I used: https://github.com/1000hz/bootstrap-validator Here is…
Terence
  • 652
  • 11
  • 34
4
votes
1 answer

How to avoid submitting in the form of react-bootstrap-validation when press the enter key

I used the form component in react-bootstrap-validation, and here are many input, checkbox and a submit button in the form.
3
votes
1 answer

How to dynamically pass an id to url of Bootstrap validator rule: remote for a same form input field?

Bootstrap Validator v 0.5.2 is being re-used for validating form (#myForm) in a modal. Need is dynamically pass an unique id (Foreign Key) to 'url' of 'remote' rule when form loads on a modal as below. var remoteUrl = "/remoteurl/"; var id =…
3
votes
0 answers

Validate Selectize.js fields with Bootstrap 3 Validator

I'm currently working on a form where i've implemented the Selectize.js and Bootstrap 3 Validator plugin. Now I've a problem with the validation of the selectize input fields on submitting the form. When I submit the form without selecting any…
3
votes
1 answer

Google INVISIBLE reCaptcha + Bootstrap validator

I have a registration form with Bootstrap validator. I want to validate the google INVISIBLE reCaptcha (client-side) before submitting the form. There is some exapmle (Invoking the invisible reCAPTCHA challenge after client side validation). I tried…
BuMoRi
  • 45
  • 2
  • 6
3
votes
1 answer

enable and disable field validation using bootstrapValidator

So I tried to check couple of solutions online but I couldn't find a solution that solve my problem regarding enabling and disabling field validation using bootstrapvalidator. I have a field that supposed to give error when someone enter a negative…
3
votes
0 answers

e.preventDefault() disabling tabindex html form

I have a simple 3 step html form for registration procedure. And I'm using bootstrapValidator for validating regexpr. The problem I'm facing is on submission of each step form I'm running a success function according to bootstrapValidator docs like…
1
2 3
11 12