ronald
ronald

Reputation: 163

In Grails, I cannot override the default error message

class User {
     String userName
     static constraints = {
        userName nullable:false
     }
}

*** I tried the different combination of the following in the message.properties ***
User.userName.null.message=The User Name cannot be null/blank
User.userName.null=The User Name cannot be null/blank
[package].User.userName.null.message=The User Name cannot be null/blank 
[package].User.userName.null=The User Name cannot be null/blank 

But still no luck. I still receving the default error message which is "Property[userName] of clas[package_name] cannot be null. I'm using Grails 3.0.8

Upvotes: 0

Views: 521

Answers (1)

saw303
saw303

Reputation: 9072

The key is user.userName.nullable. Use the following entry in your resource bundle.

user.userName.nullable=Your custom text

Upvotes: 1

Related Questions