Play! 2.0 Overwrite “Invalid Value” Message [duplicate]

人走茶凉 提交于 2019-12-11 02:25:36

问题


Possible Duplicate:
What are the i18n message ids for field infos and errors?

Using Annotations like @Required on a @Entity-class, a message attribute can be set easily. But how to set / overwrite the "Invalid value" message that is shown when a member of type Double is filled with a string on the form?

The form.errors()-map contains an error with key "field name" and value "error.invalid", but I can't figure out the correct key to use in the messages file to overwrite the default message.


回答1:


You have to override labels from the source messages file in your own messages.xy files.

Also take a look at the other answer some time ago there was a problem if file for default language hasn't the lang extension. AFAIK it was fixed after that answer, however it would be cool if you'll check it and confirm the current state in the comment.



来源:https://stackoverflow.com/questions/12773009/play-2-0-overwrite-invalid-value-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!