我正在验证该表单并使用jQuery
对话框显示错误。
这是一个jQuery
代码,在弹出窗口中显示错误摘要:
function WebForm_OnSubmit() {
if (typeof (ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) {
$("#errorDisplay").dialog({
title: "Validation Error",
modal: true,
resizable: false,
width: 250,
buttons: {
Close: function () {
$(this).dialog('close');
}
}
});
return false;
}
return true;
}
这是我定义控件:
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAddName" Display="None" ErrorMessage="Name is Required" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtAddEmail" Display="None" ValidationExpression="^[^@]+@[^@]+\.[^@]+$" ErrorMessage="Invalid Email Address" ForeColor="Red"></asp:RegularExpressionValidator>
这是validation summary
:
是否可以更改我的验证,因此,我显示失败控件的*
并仍显示弹出的错误消息?
答案 0 :(得分:0)
我想我明白了。
我需要更改.input-link {
color: blue;
text-decoration: underline;
cursor: pointer;
}
.input-link:hover,
.input-link:focus {
color: red;
}
p {
height: 100vh;
}
并将<label class="input-link" for="email">Sign up</label>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae dolorum atque, eaque, modi ducimus commodi iure officia reprehenderit eius quasi eligendi natus aliquam dolore recusandae nobis. Perferendis inventore ea quisquam.</p>
<div id="bottom">
<input type="email" name="email" id="email" placeholder="email address">
</div>
放在两个控件的标记之间
就像那样:
Display=static