Hi,

The current impl of this method is just: error(new
ValidationError().addKey("Required"));
I.e. it just adds an error for this field and later the i18n mechanics
will use 'Required' as a key to find the actual message in the
resource bundles.
So you can provide several bundles for the different languages and
provide custom value for this key.

On Fri, Apr 6, 2012 at 12:37 PM, Christoph Leiter
<[email protected]> wrote:
> Hi,
>
> currently FormComponent#reportRequiredError() is a private method. Could it
> be made protected to allow users to override the default implementation?
>
> My use case is that I have a custom implementation of TextField that is
> language specific. Instead of showing the user "Field X is required" I want
> to display "Field X in language L is required". Currently I have to override
> FormComponent#validate() and inline validateRequired() there just to be able
> to provide my own implementation of reportRequiredError(), which is quite
> cumbersome and brittle.
>
> But if there's another, better solution, which doesn't need to make the
> method protected, I'd be happy to hear it as well.
>
>
> Thanks
> Christoph



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to