xval 从资源文件获取消息

发布于 2024-08-30 22:18:22 字数 375 浏览 1 评论 0原文

我正在开发一个 CMS 系统,该系统使用资源文件来获取信息和错误消息。客户端验证工作正常,没有问题,只是没有从资源文件中获取错误消息。在调试时,我发现 xval 似乎从 javascript 文件中获取错误消息,其中消息被设置为硬编码。有什么方法可以覆盖这个吗?

在应该与资源文件建立关系的代码下方,指定字段留空时的错误。

[Property]
    [Required(ErrorMessageResourceType = typeof(CMSMessages), ErrorMessageResourceName = "EnterValidMoney")]
    public virtual Double ShippingCost { get; set; }

I'm working on a CMS system which uses a resource file to get information and errormessages from. The client side validation is working without problems, only it's not getting the errormessage from the resource file. While debugging i figured out xval seems to get the errormessages from a javascript file where the messages are set hard-coded. Is there some way to override this?

Below the code which should make the relation to the resourcefile en specify the error when the field is left empty.

[Property]
    [Required(ErrorMessageResourceType = typeof(CMSMessages), ErrorMessageResourceName = "EnterValidMoney")]
    public virtual Double ShippingCost { get; set; }

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

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

发布评论

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

评论(1

無心 2024-09-06 22:18:22

xVal 附带了一堆消息 JS 文件(在可选/国际化文件夹中),但似乎没有关于如何使用它们的文档!

看起来您只需要包含一个

xVal comes with a bunch of message JS files (in the Optional/Internationalization folder) but there appears to be no documentation on how to use them!

It looks like you simply need to include a <script src="..."> block after the min library is inluded.

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