BootstrapValidator电子邮件验证问题

时间:2018-07-14 17:11:25

标签: ajax asp.net-mvc validation twitter-bootstrap-3

我使用BootStrapValidator.js在ASP MVC中进行表单验证,但是当我将输入框名称属性编辑为“电子邮件”时,我没有验证电子邮件正则表达式导致MVC返回输入名称=“ Email”,验证器在name =“ email”上工作“效果很好。@Html.TextBoxFor(u => u.Email, new { placeholder = "sample@domain.com", @class = "form-control", id = "Email",type="email" }) 检查员结果

<input class="form-control" id="Email" placeholder="sample@domain.com" value="" name="Email" type="email">

如果我将name =“ email”添加到@html助手,则将其更改为“ Email”

1 个答案:

答案 0 :(得分:0)

我将@Html.TextBoxFor(u => u.Email, new { placeholder = "sample@domain.com", @class = "form-control", id = "Email",type="email" })更改为@Html.TextBoxFor(u => u.Email, new { placeholder = "sample@domain.com", @class = "form-control", id = "Email",type="email",@Name= "email" }) 它固定了。