You're seeing some growth issues;  the ValidField component used the
validator: prefix and the IValidator interface.

For 4.0, Paul's created a proper approach; the validators: prefix for
the validators parameter, the translator parameter and translator:
prefix, and the new Translator and Validator interfaces; validation
can now be used with all the form control components ... probably the
#1 feature request from Tapestry 3.0.

ValidField and friends will likely go away in 4.1 or maybe 4.2.

On 8/25/05, Denis Souza <[EMAIL PROTECTED]> wrote:
> Well, making that change gave another exception: "No validator named
> 'string' has been defined."
> 
> So, since the "string" validator was not defined I just left it with
> "required" and it worked. I saw it work but I don't quite get it.
> 
> Please help me understand this:
> 
> The docs say that the proper way to use a validator is with the syntax:
> 
> validator:name[,property[=value]]*
> 
> Which would make it valid for me to use:
> 
> validator:string,required
> 
> String, being the validator and "required" being one of the validator's
> properties.
> 
> If this has changed so that I must now use the prefix "validatorS" and the
> commas to separate between different validators, instead of different
> properties for a single validator, how is it that I can pass along any
> needed properties to a validator?
> For example: If I have a validator called "MyValidator" and I want to set
> two properties in this validator (prop1 and prop2), how would I do that?
> 
> I just noticed that all validators present in the Tapestry 4 framework take
> only one property and the property always has the same name as the validator
> itself. Is that a new requirement?
> 
> 
> -----Original Message-----
> From: XYZ [mailto:[EMAIL PROTECTED]
> Sent: quinta-feira, 25 de agosto de 2005 17:20
> To: Tapestry users
> Subject: Re: Validator question in Tapestry 4
> 
> You have to use validator-S- prefix when specifying multiple validators.
> 
>    validators="validators:string,required"
> 
> On 20050825, at 161641, Denis Souza wrote:
> 
> > I'm trying to perform input validation in Tapestry 4.
> >
> >
> >
> > I have the following input field:
> >
> >
> >
> > <input jwcid="[EMAIL PROTECTED]" size="15" maxlength="50"
> > displayName="message:class-name"
> > validators="validator:string,required"
> > value="ognl:productClass.name"/>
> >
> >
> >
> >
> >
> > And when I submit the form I get this:
> >
> >
> >
> > java.lang.ClassCastException:
> > org.apache.tapestry.valid.StringValidator
> >
> > org.apache.tapestry.form.ValidatableFieldSupportImpl.validate
> > (ValidatableFie
> > ldSupportImpl.java:89)
> >
> > $ValidatableFieldSupport_105ef3b5a9e.validate
> > ($ValidatableFieldSupport_105ef
> > 3b5a9e.java)
> >
> > org.apache.tapestry.form.TextField.rewindFormComponent
> > (TextField.java:86)
> >
> > org.apache.tapestry.form.AbstractFormComponent.renderComponent
> > (AbstractFormC
> > omponent.java:104)
> >
> > ...
> >
> >
> >
> >
> >
> > A peek at the code and I find that StringValidator is an
> > "IValidator" type
> > and it's being typecast into a "Validator".
> >
> > Am I using this in a wrong way or could this be a bug? I'm using
> > Tapestry4-beta4.
> >
> >
> >
> > Thanks,
> >
> > Denis Souza
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> 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]
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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

Reply via email to