• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Grails custom error messages

 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to create a custom login error message but clearly I'm missing something. Here's what I have:



The check for uniqueness does work as expected. But I wanted to change from the default message default.not.unique.message in i18n/messages.properties to my own message. I added the following line:



as explained at http://grails.org/Validation+Reference#ValidationReference-nullable.
But it still seems to be using the default message Property [username] of class [class User] with value [mark1] must be unique.

Any ideas?


--Mark
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The documentation says: Error message code: className.propertyName.unique

Your message entry should look like:
user.username.unique=Username {2} already taken.
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. It's strange that the default messages don't follow the same format.

--Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic