You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Markus Fischer <fi...@entelechon.de> on 2007/11/22 12:12:18 UTC

T5 - validation of composite components

I have a problem implementing proper validation of composite components.
Assume I have a component consisting of two text fields. For validation, I
need to consider the contents of both. The way I understand validation, it
works thusly:

1. All fields within a form are asked by the form to pull their values out
of the incoming request and validate these values (each validating its own
value)

2. Form emits a validate() event which is propagate UPWARDS in the component
hierarchy.

Therefore, my composite component gets notified to pull its values out of
the incoming request (which it can't, but its text fields will do), but
never sees the validate() event, as it is within the form and thus below it
in the component hierarchy.

So, in effect, each text field can validate its own value, and anything
above the form can validate the component, but the component cannot validate
itself. Is that correct? What am I missing?

Is there a way to get a validate event trigger in a component once the child
components have restored their values and have validated themselves?

Thanks,
   Markus
-- 
View this message in context: http://www.nabble.com/T5---validation-of-composite-components-tf4855742.html#a13894911
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5 - validation of composite components

Posted by jeffrey ai <jf...@gmail.com>.
I havn't tried this, but I think it will work.
If your composite component inherits AbstractField, you could override
processSubmission() method to do your own validation.  Actually, this is how
TextField component do the validation.

Cheers,
Jeffrey Ai


Markus Fischer wrote:
> 
> I have a problem implementing proper validation of composite components.
> Assume I have a component consisting of two text fields. For validation, I
> need to consider the contents of both. The way I understand validation, it
> works thusly:
> 
> 1. All fields within a form are asked by the form to pull their values out
> of the incoming request and validate these values (each validating its own
> value)
> 
> 2. Form emits a validate() event which is propagate UPWARDS in the
> component hierarchy.
> 
> Therefore, my composite component gets notified to pull its values out of
> the incoming request (which it can't, but its text fields will do), but
> never sees the validate() event, as it is within the form and thus below
> it in the component hierarchy.
> 
> So, in effect, each text field can validate its own value, and anything
> above the form can validate the component, but the component cannot
> validate itself. Is that correct? What am I missing?
> 
> Is there a way to get a validate event trigger in a component once the
> child components have restored their values and have validated themselves?
> 
> Thanks,
>    Markus
> 

-- 
View this message in context: http://www.nabble.com/T5---validation-of-composite-components-tf4855742.html#a13900445
Sent from the Tapestry - User mailing list archive at Nabble.com.


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