How to customize the error message for a command object?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to customize the error message for a command object?

tomcatlee
I have a command object:

RegCommand{
String email
String name
String password
...
static constraints = {
password(blank:false,size:6..10)
...
}

}

In i18n,how to customize the validation error message for the password?
I tried the followings:
regCommand.invalid.password.size=...
regCommand.password.invalid.size=...
regCommand.password.password.invalid.size=...

But not working.

Please help me
Reply | Threaded
Open this post in threaded view
|

Re: How to customize the error message for a command object?

cazacugmihai
try this:

regCommand.password.blank = ...
regCommand.password.size.toosmall = ...
regCommand.password.size.toobig = ...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: How to customize the error message for a command object?

tomcatlee
Nice!

Thanks a lot!

Mihai Cazacu-2 wrote
try this:

regCommand.password.blank = ...
regCommand.password.size.toosmall = ...
regCommand.password.size.toobig = ...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: How to customize the error message for a command object?

tomcatlee
In reply to this post by tomcatlee
Now I want to know how to customize  'default.not.unique.message'
and is there any doc to refer to?

tomLee wrote
I have a command object:

RegCommand{
String email
String name
String password
...
static constraints = {
password(blank:false,size:6..10)
...
}

}

In i18n,how to customize the validation error message for the password?
I tried the followings:
regCommand.invalid.password.size=...
regCommand.password.invalid.size=...
regCommand.password.password.invalid.size=...

But not working.

Please help me
Reply | Threaded
Open this post in threaded view
|

Re: How to customize the error message for a command object?

cazacugmihai
Visit http://grails.org/doc/1.2/index.html and check for "constraints".

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: How to customize the error message for a command object?

tomcatlee
thanks

2009/8/19 Mihai Cazacu <[hidden email]>
Visit http://grails.org/doc/1.2/index.html and check for "constraints".

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best Regards
Tom Li