带验证的 jquery 模式弹出窗口

发布于 2024-09-24 14:43:38 字数 1070 浏览 1 评论 0原文

我正在使用一个对话框,在该对话框上执行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回梦里 2024-10-01 14:43:38

我想您的错误消息位于特定的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文