Hi I am using bootstrapValidator. The Email validation count this emial@email
valid instead of [email protected]
.
<div class="col-sm-4 form-group">
<div class="error-icon">
<label class="control-label">Email</label>
<input class="form-control" id="person_email" name="person_email" placeholder="eg: [email protected]" type="email">
</div>
</div>
Script
$('#basicBootstrapForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
person_email: {
validators: {
notEmpty: {
message: 'The email address is required'
},
person_email: {
message: 'The input is not a valid email address'
}
}
},
}
});
Any help would be appreciated.
Hi I am using bootstrapValidator. The Email validation count this emial@email
valid instead of [email protected]
.
<div class="col-sm-4 form-group">
<div class="error-icon">
<label class="control-label">Email</label>
<input class="form-control" id="person_email" name="person_email" placeholder="eg: [email protected]" type="email">
</div>
</div>
Script
$('#basicBootstrapForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
person_email: {
validators: {
notEmpty: {
message: 'The email address is required'
},
person_email: {
message: 'The input is not a valid email address'
}
}
},
}
});
Any help would be appreciated.
Share Improve this question edited Apr 11, 2016 at 23:53 Shehary 9,99010 gold badges46 silver badges75 bronze badges asked Apr 11, 2016 at 18:20 dev.learndev.learn 1872 silver badges14 bronze badges 1- Possible duplicate of Validate email address in JavaScript? – TayTay Commented Apr 11, 2016 at 18:21
1 Answer
Reset to default 3you can use the regexp
validator to define expression of email address.
regexp: {
regexp: '^[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+$',
message: 'The value is not a valid email address'
}
Validation script will be
$('#basicBootstrapForm').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
person_email: {
validators: {
notEmpty: {
message: 'The email address is required'
},
regexp: {
regexp: '^[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+$',
message: 'The value is not a valid email address'
}
}
},
}
});
Fiddle
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745097264a4611054.html
评论列表(0条)