I use the same model in two views (containing forms) and I want to provide different validation messages per view. Example:

View 1:

Please fill in this bla bla

View 2:

Fill in foo foo

I followed the i18n guides to override the default error messages for the model but I can't find a way to differentiate them per view.

Is this possible?

有帮助吗?

解决方案

IMHO, you should be using two different view models. Hence, you will have two classes/models with Single Responsibility.

Panayotis

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top