Basically, you just use the "validators" binding to specify ids for any validators you want to apply to the field:
<binding name="validators" value="validators:required,minLength=4"/>

the "validators:" prefix will look up the validator ids in the "tapestry.form.validator.Validators" configuration point.
Some predefined validators are already available, read here:
http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.fields


Or you can make your own custom validator by implementing this interface:
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/form/validator/Validator.html
and adding it to that configuration point.
Download the tapestry source and look at these files, should give you an idea on how to make a custom validator:
\framework\src\descriptor\META-INF\tapestry.form.validator.xml
\framework\src\java\org\apache\tapestry\form\validator\Email.java


On Thu, 26 Jan 2006 19:38:19 +0100, Adrian Davis <[EMAIL PROTECTED]> wrote:

I'm trying to setup some validators in a small test application I'm writing. I have to say that as a newcomer the tapestry documentation leaves a lot to be desired. There seems to be a lot of conflicting information as parts are updated for 4.0 and other parts aren't. But on to my specific question...


This is an excerpt from the TextField component reference:

A TextField may be decorated by the Form's validation delegate, but does not have a validator, so is limited in editting properties types beyond string.
In most cases, the ValidField component is preferred.


And this is an excerpt from the ValidField component:

Warning
This component has been deprecated; Tapestry 4.0 adds even better support
for validation to TextField, TextArea and most other form element component.


And there's even a link to the TextField reference page in the warning. Is
there some documentation somewhere that describes how to do TextField
validation using the 4.0 "better support for validation". Or am I looking
at the wrong reference?

Any help would be appreciated.

Thanks,
Adrian

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





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

Reply via email to