带验证的 jquery 模式弹出窗口
我正在使用一个对话框,在该对话框上执行 jquery 验证,如必需的、电子邮件等。
单击按钮时,我的对话框将显示为弹出窗口,并显示错误消息, 但是当我关闭对话框并再次打开它时,会显示以前的错误消息,直到我与控件进行交互。
所以我想要的是刷新对话框或重置验证消息,这样每当我打开对话框时,它就不会出现以前的错误消息。
提前致谢。
<div id="divAddUpdateAct" runat="server" clientidmode="Static" style="padding-left: 0">
<fieldset class="popupFieldset">
<table>
<tr>
<td> Remarks : </td>
<td colspan="3"> <textarea id="txtRemarks" runat="server" clientidmode="Static" rows="4" cols="10" class="textArea"></textarea> </td>
</tr>
</table>
</fieldset>
</div>
我正在 document.ready() 上编写以下代码或验证文本框的内容。
$('#formMaster').validate({ onsubmit: false });
$('#txtRemarks').rules("add",
{ required: true,
messages: { required: "Please enter remarks." } });
因此,当我单击验证文本区域的按钮时,它会给我错误。但是,当我单击某个在该文本区域中填充文本的链接并再次打开对话框时,错误消息仍然存在。因此,加载时文本区域中存在文本,但错误消息仍然存在,直到我单击按钮或文本区域控件。
I m using a dialog on which jquery validation is performed like required,email etc.
On click of a button my dialog appears as a popup and error messages are shown,
but when i close my dialog and open it once again the previous error messages are shown until i interact with my controls.
So i want, is to refresh the dialog or reset the validation messages so whenever i open my dialog it comes as without the previous error messages.
Thanks in advance.
<div id="divAddUpdateAct" runat="server" clientidmode="Static" style="padding-left: 0">
<fieldset class="popupFieldset">
<table>
<tr>
<td> Remarks : </td>
<td colspan="3"> <textarea id="txtRemarks" runat="server" clientidmode="Static" rows="4" cols="10" class="textArea"></textarea> </td>
</tr>
</table>
</fieldset>
</div>
I'm writing following code on document.ready() or validate the content of textbox.
$('#formMaster').validate({ onsubmit: false });
$('#txtRemarks').rules("add",
{ required: true,
messages: { required: "Please enter remarks." } });
So when I click on button which validates the textarea, it gives me error. But when I click on some link which fills text in that textarea and open the dialog again the error message remains still there. So text is there in that textarea upon loading but still error message is there until I click on button or textarea cotrol.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您的错误消息位于特定的 div 中。
您只需将该 div 的 html 内容设置为空,然后就可以显示对话框了。
如果您发布一些代码,我可以更准确。
I imagine your error message are in a particular div.
You just need to set the html content of that div to nothing and then you can display your dialog.
If you post some code, I could be more precise.