I have found a workaround from the following post in the archive.

http://www.nabble.com/How-to-inherit-or-have-a-dynamic-validate-to18127873.html#a18139604


Instead of passing  something like required,min=0 as a FieldValidator to my 
component, I need to pass it as a String and create the corresponding 
FieldValidator in my component java class. 
FieldValidatorDefaultSourceImpl.createDefaultValidator has the code to create a 
Validator.

It would be so much easier and logical to pass in  required,min=0  as a 
FieldValidator from a Page class to the component, without the component 
having to implement the Field interface.

Shing


--- On Sun, 23/11/08, Shing Hing Man <[EMAIL PROTECTED]> wrote:

> From: Shing Hing Man <[EMAIL PROTECTED]>
> Subject: Tap 5.0.16 : How to pass in a validator to an embedded TextField 
> componet.
> To: "tapestry Tapestry" <[EMAIL PROTECTED]>
> Date: Sunday, 23 November, 2008, 9:37 PM
> I have created a component, SingleInputRowTable,  
> which is just a loop over a TextField component for 
> inputting a list of numbers. 
> 
> The validation on the input numbers varies from case to
> case.
> So, I would like to pass in a validator to
> SingleInputRowTable for the embedded TextField component.
> 
> 
> When I added  parameter 
>           
>   @Parameter(defaultPrefix =
> BindingConstants.VALIDATE,required=false)
>       private FieldValidator<Object> validate;
> to SingleInputRowTable.java 
> and specified the embedded TextField.valdate to inherit
> from above, 
> the following exception occurred.
>   
> 
> Could not convert 'required,min=0' into a component
> parameter binding: 
> Component 'credit/CDSSpread:singleinputrowtable' is
> not a field (it does not implement the Field interface) and
> may not be used with the validate: binding prefix.
> 
> 
> The SingleInputTableRow.java does not implement the 
> interface Field.
> 
> 
> Is there an easy way to pass in a validator to
> SingleInputRowTable (or 
>   do away with  hardcoding the validate parameter of the
> embedded TextField)?
> 
> Thanks in advance for any assistance !
> 
> Shing 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Home page : http://www.lombok.demon.co.uk/




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to