You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Mittendorf <ch...@freenet.de> on 2006/01/08 11:00:37 UTC
Validate multiple form fields together?
Hello!
I was making up my mind about how to handle validation for multiple
form fields, but I don't get it yet. Lets start with an example:
A bank account contains an account number and a bank code. There are
methods available that can validate if both values together are a
valid combination or not.
Thus I created a component that is responsible for displaying this
information inside a form. It mainly consists of two text fields. The
component has one parameter, a BankData object.
Each of these fields can have a validator assigned taking care of
null values, the format, etc. That is one part of the validation
process.
I then created a BankDataValidator implementing the Validator
interface and assigning it to the component. However, that is not
working because my BankData component is a simple BaseComponent and
not extending form field component. The idea might be right, but
technically I think I'm on the wrong way.
I can, of course, validate both field in my listener method, that is
not a problem. But I would like to bundle the validation logic with
the BankData component and keep it inside the component and not
within a listener method. Very much like the validation for each form
field is bound to the field and not the listener method,
Any hint and idea on a "how to" would be great! Thanks in advance!
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org