必填字段验证器问题

发布于 2024-08-23 10:48:30 字数 447 浏览 2 评论 0原文

我的必填字段控件正在验证“SEL”(默认无效值)值,但是当我将该值更改为有效值时,错误消息/文本不会消失,直到我再次提交表单。

<asp:DropDownList ID="ddlDocumentType" runat="server" DataTextField="Description" DataValueField="Code" />
 <asp:RequiredFieldValidator ControlToValidate="ddlDocumentType" Text="*" ID="rfvDocumentType" runat="server" Display="Dynamic" InitialValue="SEL" />

它发生在我所有的下拉列表/必需字段验证器中。当我更改下拉列表上的值时,文本/错误消息如何消失?我猜当选项有效时它必须消失!

谢谢,

My requiredfield control is validating the "SEL"(default invalid value) value but when I do change the value to a valid one, the ErrorMessage/Text does not disappear until I submit the form again.

<asp:DropDownList ID="ddlDocumentType" runat="server" DataTextField="Description" DataValueField="Code" />
 <asp:RequiredFieldValidator ControlToValidate="ddlDocumentType" Text="*" ID="rfvDocumentType" runat="server" Display="Dynamic" InitialValue="SEL" />

It happens in all my dropdownlists/requiredfieldvalidators. How does the Text/ErrorMessage disappear when I change the value on the dropdownlist ? I'm guessing it has to disappear when the option is valid !

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

陪你到最终 2024-08-30 10:48:30

此处讨论了类似的问题。我认为问题在于验证 javascript 的工作方式。只是为了尝试,您还可以添加 EnableClientScript=true 属性。

A similar question is discussed here. I think the problem is the way validation javascript works. Just to try, you can also add EnableClientScript=true attribute.

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