Reputation: 5040
When any validation fails in domain/commandObjects, the error message is taking from message.properties and formatted with the fieldName, i.e
Property {0} must be a valid number
will be shown as
Property deviceTemperature must be a valid number
How can I change the field name to a readable string without changing the error message like:
Property Device temperature must be a valid number
Upvotes: 0
Views: 107
Reputation:
If you look at a generated form GSP you will find the Grails convention. Example:
class Book {
String title
}
<label for="title">
<g:message code="book.title.label" default="Title" />
</label>
So you can always use domainClassName.propertyName.label
.
Upvotes: 1