To be honest, I hadn't used it. I looked at it more closely, and it won't do /quite/ what you want. Tapestry will look up the /constraints/ to use for a particular validator in the message catalog for the containing page/component,
but it won't look up the actual /validators/ to use.
So if you had:
<t:textfield validate="required,regexp"/>

You could include:

fieldid-regexp=^[a-zA-Z]+$

and that would be the regular expression for your validator.

I think it would be useful, however, to be able to define the set of validators to use in a message catalog.

That would entail a new ValidationConstraintGenerator, except... there's no simple way for a ValidationConstraintGenerator implementation to gain access to the message catalog for the page or component that holds the component for which the constraints should be generated. The behavior I described above is handled at a level outside of the constraint generator. Still... if you add an issue, I'll grab it and explore options.

Robert

On May 4, 2009, at 5/411:37 AM , mraible wrote:


Do you have more information on #2? I'm not familiar with Tapestry's property
catalogs.

Thanks,

Matt


Robert Zeigler wrote:

There are a variety of things you can do.
You can:
   1) Put validation annotations on the bean properties that tapestry
will pick up
   2) Put validation information in the property catalogs that
tapestry will pick up
   3) Write and contribute your own constraint generator.  For
example, in the tapestry5-cayenne integration module, there is a
CayenneConstraintGenerator that builds constraints based on metadata
available from the cayenne mapping.

For AppFuse, I would recommend #2 because it's non-intrusive (nothing
in the POJO) and it allows you to use the BeanEditForm, and it allows
you to easily modify (w/out compilation) the validation constraints.

Cheers,

Robert

On May 4, 2009, at 5/410:26 AM , mraible wrote:


Thanks for the pointer. I guess for something like AppFuse, using the
BeanEditForm (esp. with code generation) is probably not a good
idea. I'll
change things to generate the individual field elements so users can
more
easily modify the generated template.

Matt


Ulrich Stärk wrote:

I don't exactly get what you mean. You can validate for example
textfield
by passing a validator to
the validate parameter of some of the components. For example
<t:textfield
value="someProperty"
validate="required /> would make sure that someProperty actually
has a
value. See
http://tapestry.apache.org/tapestry5.1/guide/validation.html

Uli

mraible schrieb:
Is it possible to do validation declaratively, or rather - only at
the
web
tier? AFAIK, I can only do validation with 1) annotations on the
model
object or 2) manually with if (blank) logic in my Page.

Thanks,

Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




--
View this message in context:
http://www.nabble.com/Tapestry-5-Validation-tp23358011p23370724.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




--
View this message in context: 
http://www.nabble.com/Tapestry-5-Validation-tp23358011p23371981.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to