javascript - Bootstrap Validator for email address - Stack Overflow

Hi I am using bootstrapValidator. The Email validation count this emial@email valid instead of [email p

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
Add a ment  | 

1 Answer 1

Reset to default 3

you 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

相关推荐

  • javascript - Bootstrap Validator for email address - Stack Overflow

    Hi I am using bootstrapValidator. The Email validation count this emial@email valid instead of [email p

    16小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信