ASP.NET 提交按钮 requiredFieldValidator 未通过 Facebox 触发
我试图为我正在开发的网站创建一个弹出登录表单,所以我决定尝试一下 Facebox。登录弹出正常,但提交按钮和所需的验证器未触发。它位于母版页内,并包含在进度面板中。
在页眉中,我有:
<script type="text/javascript">
$(document).ready(function () {
$('a[rel*=facebox]').facebox();
});
</script>
在表单顶部,我有此链接:
<a href="#logon_form" rel="facebox">Logon</a>
这是打开下面列出的层:
<div id="logon_form" style="display:none;">
<table cellpadding="3" cellspacing="0" border="0" class="centered">
<tr>
<td>Email:</td>
<td><asp:TextBox ID="TextLogonEmail" runat="server" CssClass="inputtext" ValidationGroup="LogonGroup" Columns="35" MaxLength="320"></asp:TextBox></td>
<td><asp:RequiredFieldValidator ID="RequiredLogonEmail" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextLogonEmail" ValidationGroup="LogonGroup" CssClass="error">required</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Password:</td>
<td><asp:TextBox ID="TextLogonPassword" runat="server" CssClass="inputtext" TextMode="Password" ValidationGroup="LogonGroup" Columns="35" MaxLength="40"></asp:TextBox></td>
<td><asp:RequiredFieldValidator ID="RequiredLogonPassword" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextLogonPassword" ValidationGroup="LogonGroup" CssClass="error">required</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><asp:Button ID="ButtonLogon" runat="server" Text="Logon" ValidationGroup="LogonGroup" onclick="ButtonLogon_Click" /></td>
</tr>
</table>
</div>
有什么想法吗?
I was trying to create a popup logon form for a site I'm working on so I decided to give facebox a try. The logon pops up ok, but the submit button and required validators are not firing. This is within the master page and is contained with a Progress Panel.
In the page header, I have:
<script type="text/javascript">
$(document).ready(function () {
$('a[rel*=facebox]').facebox();
});
</script>
Towards the top of the form, I have this link:
<a href="#logon_form" rel="facebox">Logon</a>
Which is to open the layer listed below:
<div id="logon_form" style="display:none;">
<table cellpadding="3" cellspacing="0" border="0" class="centered">
<tr>
<td>Email:</td>
<td><asp:TextBox ID="TextLogonEmail" runat="server" CssClass="inputtext" ValidationGroup="LogonGroup" Columns="35" MaxLength="320"></asp:TextBox></td>
<td><asp:RequiredFieldValidator ID="RequiredLogonEmail" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextLogonEmail" ValidationGroup="LogonGroup" CssClass="error">required</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>Password:</td>
<td><asp:TextBox ID="TextLogonPassword" runat="server" CssClass="inputtext" TextMode="Password" ValidationGroup="LogonGroup" Columns="35" MaxLength="40"></asp:TextBox></td>
<td><asp:RequiredFieldValidator ID="RequiredLogonPassword" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextLogonPassword" ValidationGroup="LogonGroup" CssClass="error">required</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><asp:Button ID="ButtonLogon" runat="server" Text="Logon" ValidationGroup="LogonGroup" onclick="ButtonLogon_Click" /></td>
</tr>
</table>
</div>
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
Page.Validate("LogonGroup")
,或者如果您想使用 Javascript 调用它,请尝试:--EDIT--
您可以在
ButtonLogon_Click
事件中提供该内容。就像,理想情况下,你的代码应该可以工作。我会添加
ValidationSummary
< /a> 在您的LogonForm Div
中。例如:因此,当您单击登录按钮时,它将显示验证摘要。
Try
Page.Validate("LogonGroup")
, or if you want to call it using Javascript, try:--EDIT--
You can provide that inside your
ButtonLogon_Click
event. Like,Ideally, your code should work. I would add the
ValidationSummary
within yourLogonForm Div
. For instance like:So, when you click on the login button, it would show the validation summary there.