从 xVal 验证中排除 ID 属性

发布于 2024-08-28 13:33:12 字数 81 浏览 3 评论 0原文

我可以排除 ID 财产的评估规则吗?现在,当我提交表单时,我收到以下验证错误消息:

  • Id 字段是必需的。

Can I exclude the valudation rule for the ID property? Right now I get the following validationerror message when I submit the form:

  • The Id field is required.

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

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

发布评论

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

评论(1

孤城病女 2024-09-04 13:33:12

来自 http://xval.codeplex.com/Thread/View.aspx?ThreadId =54212

获取 ModelState.IsValid = false 并显示消息“ID is required”

我认为您在这里谈论的是服务器端验证。请记住,xVal 的关键工作是启用客户端验证,这样就不会出现此问题。在客户端上,您不会为“ID”创建文本框(因为您不希望用户直接编辑它) - 至少在创建阶段不会 - 因此客户端验证器将忽略 ID 属性,不尝试验证它,因为没有要验证的输入控件。
在服务器上,行为将根据您使用的验证运行器而有所不同。

From http://xval.codeplex.com/Thread/View.aspx?ThreadId=54212

getting a ModelState.IsValid = false with a message of “ID is Required”

I think you're talking about server-side validation here. Remember that xVal's key job is enabling client-side validation, where this problem doesn't occur. On the client, you won't create a textbox for "ID" (because you wouldn't want the user to edit it directly) - at least not during the creation phase - so the client-side validator would ignore the ID property, not attempting to validate it because there's no input control to validate.
On the server, the behaviour will vary according to which validation runner you're using.

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