I think you could do this with JSR303 validators if you detect it's a field
and pass the value of the field to the validator.

See: https://github.com/trsvax/tapestry-nocode/blob/master/04.md for a way
to automatically validate in the onValidate event

On Thursday, September 15, 2016, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Hi,
>
> I want to use the @Validate annotation, but I cannot put it at the value
> properties, because these properties are part of a DTO object that is part
> of a library.
> In the documentation (http://tapestry.apache.org/cu
> rrent/apidocs/org/apache/tapestry5/beaneditor/Validate.html) I found the
> following: " May be placed on any getter or setter method, or on the
> matching field".
>
> So I thought I could do the following:
>
> @Validate("regexp="+SOME_REGEXP)
> @InjectComponent
> private Field someField;
>
> But this does not seem to work?
>
> Is there any other way to add validators to a field programatically when
> you have no access to the property declarations?
> I could do all validation myself in the onValidate event, but this does
> not seem optimal.
>
> Nathan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to