简体   繁体   English

自定义DotNetNuke模块开发表单验证

[英]Custom DotNetNuke module development form validation

I am using the Module Creator module within DotNetNuke to create a very basic contact form. 我正在使用DotNetNuke中Module Creator模块来创建一个非常基本的联系表。 The form works as intended, but I'm having trouble with the validation. 该表格可以按预期工作,但是我在验证时遇到了麻烦。

When one submits the form without properly filling out the required fields, it invokes the form validation and displays the appropriate error messages. 如果提交表单时未正确填写必填字段,它将调用表单验证并显示适当的错误消息。 However, if I'm not trying to fill out the form and instead am selecting admin features of DotNetNuke to administer the site, the form validation for my custom module fires and prevents me from using the core functionality... 但是,如果我不尝试填写表单,而是选择DotNetNuke的管理员功能来管理站点,则会触发针对我的自定义模块的表单验证,并阻止我使用核心功能...

How do I prevent my form from being submitted when DotNetNuke admin functionality is what is being clicked? 当单击DotNetNuke管理功能时,如何防止提交表单?

Thanks for any help provided. 感谢您提供的任何帮助。

Solution is ValidationGroup 解决方案是ValidationGroup

Use the validationgroup on your controls that has to be checked and at the validationgroup to your button. 在必须检查的控件上以及按钮的验证组上使用验证组。

Control with Requiredfieldvalidator: 使用Requiredfieldvalidator进行控制:

<asp:textbox id="tbName" runat="Server"/>
<asp:requiredfieldvalidator id="rfvName" controltovalidate="tbName" validationgroup="Save" errormessage="Enter your name."
      runat="Server"/>

Button: 按键:

<asp:LinkButton ID="lbSave" ValidationGroup="Save" resourcekey="cmdAdd"  runat="server" class="dnnPrimaryAction" OnClick="Onclick_lbSave" /></li>

Thank you JK84! 谢谢JK84! The use of ValidationGroup on my required field validators did the trick. 在所需的字段验证器上使用ValidationGroup可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM