Validators / emailAddress

Edit on Github

Validate an email address.

Option Equivalent HTML attribute Type Description
message data-bv-emailaddress-message String The error message
This validator passes an empty field since the field might be optional. If the field is required, then use the notEmpty validator.

Example

Email address Result
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
"much.more unusual"@example.com
"[email protected]"@example.com
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
admin@mailserver1
!#$%&'*+-/=?^_`{}|[email protected]
" "@example.org
üñîçøðé@example.com
üñîçøðé@üñîçøðé.com
Abc.example.com
A@b@[email protected]
a"b(c)d,e:f;gi[j\k][email protected]
just"not"[email protected]
this is"not\[email protected]
this\ still\"not\\[email protected]
<form id="emailForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-lg-3 control-label">Email address</label>
        <div class="col-lg-7">
            <input type="text" class="form-control" name="email" />
        </div>
    </div>
</form>
<script>
$(document).ready(function() {
    $('#emailForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            email: {
                validators: {
                    emailAddress: {
                        message: 'The value is not a valid email address'
                    }
                }
            }
        }
    });
});
</script>
<form id="emailForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-lg-3 control-label">Email address</label>
        <div class="col-lg-5">
            <input class="form-control" name="email"
                type="email"
                data-bv-emailaddress-message="The value is not a valid email address" />
        </div>
    </div>
</form>
<script>
$(document).ready(function() {
    $('#emailForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        }
    });
});
</script>

Comments

If you want to report a bug, please submit the issue on Github. Do NOT post the issue here.

For a general question or feedback, use the form below.