I have a domain constraint which I am validating like
userName(blank:false, nullable:false, Size: 5..50,matches:'^[A-Za-z\\d]*$',validator:{chkUser,user->if(user.loginService.getUser(user.organizationId,user.userName)!=null){
return[propertyName="userName"]}
})
So what I am trying to do is call login service and see if username exists. IF the username exists I have to return message USerName already exists. I have modified my message.properties as:
BuildUserNameCommand.userName.matches= Username Should have alphanumeric characters only
BuildUserNameCommand.userName.invalid.userName=Username already exists
BuildUserNameCommand.userName.validator.error= Username already exists
buildusernamecommand
is my class name. I have also tried return['invalid.userName']
in the constraint. But still its not displaying the custom message.
Help me out please....