我使用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”
答案 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" })
它固定了。