Re: Returning a FieldValidator to a TextField
On 29 January 2010 17:47, Thiago H. de Paula Figueiredo thiag...@gmail.comwrote: Inject FieldValidatorSource and use its FieldValidator createValidators(Field field, String specification) method to generate a FieldValidator. Then create a FieldValidator getValidator() method using createValidators() and add t:validate=prop:validator to your TextField. Thanks, this got me in the right direction. I can already create a fieldValidator successfully. The thing is that I found to create it I need to have a @InjectComponent(textFieldName) and the only way I know to do this is inside a page Class. I resolved this adding a fieldValidator to each of my Field object when I render the page. My code is like this: t:loop source=fields value=currentField t:formstate=ITERATION t:if test=currentField.visible tr tdlabel for=currentField.fieldName${currentField.fieldName}:/label /td tdinput type=text t:type=TextField t:id=field t:value=currentField.fieldValue t:validate=prop:currentField.fieldValidator//td /tr /t:if /t:loop This works fine except when using InjectComponent I need to give it a fieldId and since I use a loop I don't really know what the field ID's are (except that they are ID_0, ID_1, etc..) . This is not critical but in a presentation point of view it points the errors to the wrong field. Is there any way to bind a fieldValidator to a field without using InjectComponent in the page class? Thanks in advance, Nuno Ferreira
Returning a FieldValidator to a TextField
Hello all, I'm new to tapestry and wanted to do a simple form with user defined fields. I have a Field class which contains a String Value and a String set of restrictions. I wanted to do something like this: input type=text t:type=TextField * t:validate=currentField.fieldValidator* t:value=currentField.fieldValue / My idea was to use the already existing FieldValidators like required, regexp, min, etc... Would like you're opinion on how to do this, if its even possible. I'm a bit clueless. Thanks in advance, Nuno Ferreira
Re: Returning a FieldValidator to a TextField
On Fri, 29 Jan 2010 10:33:10 -0200, Nuno Ferreira nuno.ny...@gmail.com wrote: Hello all, Hi! My idea was to use the already existing FieldValidators like required, regexp, min, etc... Inject FieldValidatorSource and use its FieldValidator createValidators(Field field, String specification) method to generate a FieldValidator. Then create a FieldValidator getValidator() method using createValidators() and add t:validate=prop:validator to your TextField. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, 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