I am thinking that you may need to: define a bean and it's properties, then pass it to the validator parameter. You are right, still, that tapestry 4 validators are confusing, even after reading the java source.

Perhaps someone who has had success with multiple validators, including custom validators, could elaborate on this issue.

On 20050825, at 164249, Denis Souza 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]




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

Reply via email to