You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoffrey Wiseman <gw...@exchangesolutions.com> on 2005/11/01 22:16:41 UTC

Multi-Field Validation in For Loops

I've seen patterns for validation that requires more than one field in
Tapestry:

*	During the listener, look at your page data, do whatever you
need to do to validate the fields.
*	If there is a problem:

	*	Get the validation delegate
	*	Set the form component
	*	Record the validation problem

For instance, this:
http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200401.mb
ox/%3C049201c3df12$6dcfdbd0$2400a8c0@turbonium%3E
 
I've also seen that validation can work within For loops (the
component's name increments; validators for the field set the component
using the name, and record the exception).  The problem is, I don't see
how to combine these two approaches well, and at a quick glance,
Tapestry 4's validation doesn't solve that problem either.
 
Is there a pattern that works with tapestry here?  Preferably 3.0.3, but
even 4.0 would be worth knowing.
 
Thanks,
 
    - Geoffrey
 

Geoffrey Wiseman
direct: 416.646.7124

main: 416.646.7000 
fax: 416.646.7050 

Exchange Solutions Inc.
250 Yonge Street, 18th Floor
Toronto, ON M5B 2L7
www.exchangesolutions.com

 

Re: Multi-Field Validation in For Loops

Posted by Chris Norris <th...@gmail.com>.
I don't have a good solution for this. We have a number of places where
there are Foreach loops and fields inside that need validation. For single
fields, it's easy enough to write your own custom validators, but for the
cases where you need to use values from multiple fields to perform
validation, it's pretty hard. You can determine that things are invalid,
yes, but marking them as invalid seems next to impossible. I'd like to see a
solution to this. If anyone has one, speak up!

-Chris

On 11/1/05, Geoffrey Wiseman <gw...@exchangesolutions.com> wrote:
>
> I've seen patterns for validation that requires more than one field in
> Tapestry:
>
> * During the listener, look at your page data, do whatever you
> need to do to validate the fields.
> * If there is a problem:
>
> * Get the validation delegate
> * Set the form component
> * Record the validation problem
>
> For instance, this:
> http://mail-archives.apache.org/mod_mbox/jakarta-tapestry-user/200401.mb
> ox/%3C049201c3df12$6dcfdbd0$2400a8c0@turbonium%3E
>
> I've also seen that validation can work within For loops (the
> component's name increments; validators for the field set the component
> using the name, and record the exception). The problem is, I don't see
> how to combine these two approaches well, and at a quick glance,
> Tapestry 4's validation doesn't solve that problem either.
>
> Is there a pattern that works with tapestry here? Preferably 3.0.3, but
> even 4.0 would be worth knowing.
>
> Thanks,
>
> - Geoffrey
>
>
> Geoffrey Wiseman
> direct: 416.646.7124
>
> main: 416.646.7000
> fax: 416.646.7050
>
> Exchange Solutions Inc.
> 250 Yonge Street, 18th Floor
> Toronto, ON M5B 2L7
> www.exchangesolutions.com <http://www.exchangesolutions.com>
>
>
>
>