I just wanted to know about best practices to validate components that are
used as part of a form but that are not IFormComponent (something that
happen pretty often in our code).

e.g. we have a "LegalId" component made by a select box where you choose the
type of id you are inserting plus an input field with the actual legal id
alphanumeric code (we use tapestry IFormComponent for these two fields). As
we have to validate differently the input field depending on the select
value, validation must happen at LegalId component level so we can't use
validators/translators; the way we go  is this:

1) inject the IValidationDelegate as a bean in the legalid component
2) use the validationdelegate to record validation errors on rewind in
pageEndRenderer, at this point, on a form submit, the rewind process will
have set all form properties and we'll be able to use all these properties
to make component level validation.

It seems it's working but it took us some time to get to this method, it
seems strange to me that there isn't a more "standard" way to do this nor
that there isn't any documentation about it.

Any suggestion?

Thanks.

Martino

Reply via email to