Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Grails custom error messages

 
Author
Posts: 6049
2
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • 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
Author
Posts: 6049
2
  • 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
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic