Reputation: 3609
Github source code https://github.com/grails-samples/grails-petclinic
Customised message has been specified, unfortunately it doesn't work.
owner.firstName.blank=You must specify a first name
It shows error message "Property [firstName] of class [class org.grails.samples.Owner] cannot be null" instead of "You must specify a first name".
I have found the same issue in this screencast http://grails.org/screencast/22
Upvotes: 0
Views: 47
Reputation: 24776
The issue you are running into is that you aren't customizing the correct message code. If you read closely you will see it's violating the nullable
constraint not the blank
constraint.
You should use:
owner.firstName.nullable=You must specify a first name
This may be confusing because in recent versions of Grails the default behavior for handling blank values for String
s was changed to use null
instead of blank. There is a configuration option available to control this in Config.groovy
if you wish to change back to the old behavior.
Upvotes: 2