OK I understand how to do that and it works as long as I know the name of yourField so I can use:
@InjectComponent private Field yourField; In order to have yourField to create the Validator. This would require knowing the name and number of fields at compile time. In my code, the fields are generated from user specified attributes so I don't know what they are called until the app is running. Maybe a better question is this: Is there a way to get a Field at run time so I can pass it to the createValidator method? Or, is there a way to create a Validator that figures out what field it is attached to based on where it is used in the template instead of needing to be told when it is created? Thank you for your help. Jack -----Original Message----- From: "Thiago H. de Paula Figueiredo" <thiag...@gmail.com> Sent: Tuesday, May 24, 2011 4:09pm To: "Tapestry users" <users@tapestry.apache.org>, jackkuros...@w9z.org Subject: Re: dynamic validation for required / not required On Tue, 24 May 2011 16:50:46 -0300, <jackkuros...@w9z.org> wrote: > Is there a way to tell Tapestry to use: > validate="${validationText}" > so if getValidationText returns the string "required" it will act the > same way as if you wrote: validate="required"? As already stated, you need to pass a FieldValidator instance to the validate parameter. FieldValidatorSource is the easiest way. <... validate="prop:customValidation"> public FieldValidator getCustomValidation() { ... } Tapestry doesn't have templates with dynamic structure, so you'll be able to get the Field instance to pass to the FieldValidatorSource methods. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org