2

I am using the convention plugin. Below is the @Validations annotation.

@Validations(
        requiredFields={@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "revenue", message = "You must enter a value for field.")},
         intRangeFields =
                { @IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "revenue", min = "1", max = "100", message = "id must be between 1 to 100.")},
         conversionErrorFields={@ConversionErrorFieldValidator(message="Not a valid Number", type= ValidatorType.SIMPLE, fieldName="id")}
        )

so when ever i am giving a character instead of number in the field to test. I am getting these 3 messages.

Invalid field value for field "id".
Not a valid Number
You must enter a value for field.

Instead i am expecting to get only the second or the first one. N from where i am getting the first error. As we can see that i have not given any such message. So how can i get only one appropriate message at a time.

Regards.

Aadam
  • 1,521
  • 9
  • 30
  • 60

1 Answers1

0

Create new file in same package where your action class is defined,.”actionclassname.properties” and in that file use this “invalid.fieldvalue.FieldName=give msg for user”.it is working also in my case it is working