03 Aug 2009, 17:32
Generic-user-small

Jim Smith (2 posts)

We are still using Stripes 1.4. We are planning to go to Stripes 1.5 eventually, but for now we’re on 1.4, so please help if you can on how I can customize a message when using the @Validate annotation in 1.4

I have an annotation like this: @ValidateNestedProperties({ @Validate(field = “consumerContact”, required = true, maxlength = 4, on = “saveData”), @Validate(field = “manufacturerName”, required = false, maxlength = 7)}) The Domain object they are part of is called OrderDescription

Using consumerContact as an example, I get these types of error messages: Order Description Consumer Contact is a required field Order Description Consumer Contact must be no more than 4 characters long

In 1.5, the added annotation “label” will do what I need, but alas, we’re on 1.4.

What can I use in Stripe’s ResourceProperties to format the message the way I like? Are the parts that make up the error message in {0}, {1}, etc. For example, I’d like the messages to be (corresponding to the two examples above): You must enter a value in the Contact field. The value you enter for Contact must be at least 4 characters.

Any help will be greatly appreciated.

10 Aug 2009, 14:03
Freddy_avatar_pragsmall

Fred Daoud (21 posts)

Hi Jim,

Try this, in StripesResources.properties:

orderDescription.consumerContact.valueNotPresent=You must enter a value in the Contact field.
orderDescription.consumerContact.valueTooShort=The value you enter for Contact must be at least {2} characters.

Hope that helps. Frederic Daoud

12 Aug 2009, 12:39
Generic-user-small

Jim Smith (2 posts)

That worked fine: thanks!

  You must be logged in to comment