You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2005/09/16 19:08:15 UTC

docs for textfield

hey, are there any docs for the @textfield component on how to validate
it as of T4? there aren't any in the component reference that comes with
the source.

-- 
Dan Adams
Software Engineer
Interactive Factory


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: docs for textfield

Posted by Nick Stuart <ba...@gmail.com>.
Also of note, the "string" part of the validator is not needed. and in
fact none of the type validators are needed as I believe they are
being replaced by the translators. there are examples of these in the
distribution under 'examples'  :)

Hope this helps!
-Nick

On 9/16/05, Dan Adams <da...@ifactory.com> wrote:
> well, this is very confusing because the docs are totally incorrect on
> the site (or rather they should be updated to include "validators:").
> After some digging through I code I found out that if you do
> validator:string,required it creates a StringValidator with
> required=true which implements IValidator whereas if you do
> validators:required it creates a Required object that implements
> Validator.
> 
> fyi: to find available validators to use with TextField look in
> org.apache.tapestry.form.validator. Currently there are the following:
> 
> Email
> Max
> MaxDate
> MaxLength
> Min
> MinDate
> MinLength
> Pattern
> Required
> 
> :)
> 
> On Fri, 2005-09-16 at 20:39 +0200, Tomáš Drenčák wrote:
> > I did the same mistake like you:). For validators prefix is validators
> > not validator!
> >
> > <input jwcid="schoolName@TextField" type="text"
> > value="ognl:site.school.name"   displayName="message:label.schoolname"
> > validators="validators:string,required" />
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: docs for textfield

Posted by Dan Adams <da...@ifactory.com>.
well, this is very confusing because the docs are totally incorrect on
the site (or rather they should be updated to include "validators:").
After some digging through I code I found out that if you do
validator:string,required it creates a StringValidator with
required=true which implements IValidator whereas if you do
validators:required it creates a Required object that implements
Validator.

fyi: to find available validators to use with TextField look in
org.apache.tapestry.form.validator. Currently there are the following:

Email
Max
MaxDate
MaxLength
Min
MinDate
MinLength
Pattern
Required

:)

On Fri, 2005-09-16 at 20:39 +0200, Tomáš Drenčák wrote:
> I did the same mistake like you:). For validators prefix is validators
> not validator!
> 
> <input jwcid="schoolName@TextField" type="text"
> value="ognl:site.school.name"   displayName="message:label.schoolname"
> validators="validators:string,required" />
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: docs for textfield

Posted by Tomáš Drenčák <to...@gmail.com>.
I did the same mistake like you:). For validators prefix is validators
not validator!

<input jwcid="schoolName@TextField" type="text"
value="ognl:site.school.name"   displayName="message:label.schoolname"
validators="validators:string,required" />

2005/9/16, Dan Adams <da...@ifactory.com>:
> Well, i tried the following:
> 
> <input jwcid="schoolName@TextField" type="text"
> value="ognl:site.school.name"   displayName="message:label.schoolname"
> validators="validator:string,required" />
> 
> but when it does the rewind it throws an exception. i traced into the
> source the string validator it creates is
> org.apache.tapestry.valid.StringValidator which is correct except that
> it implements IValidator and it gets cast to
> org.apache.tapestry.form.validator.Validator which does not extend
> IValidator. This looks like it might be a bug or I am doing something
> wrong or both.
> 
> On Fri, 2005-09-16 at 20:11 +0200, Tomáš Drenčák wrote:
> > Here's an simple example which uses required validator
> >
> > @Component(type = "TextField", bindings = { "value=produkt.nazov",
> > "validators=validators:required", "displayName=message:nazov" })
> > public abstract TextField getNazov();
> >
> > or
> >
> > @Component(type = "TextField", bindings = { "value=kontakt.email",
> > "validators=validators:email", "displayName=message:email" })
> > public abstract TextField getEmail();
> >
> > validator properties could be set by comma and parameter=value syntax
> > (validators:val, parameter=value)
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: docs for textfield

Posted by Dan Adams <da...@ifactory.com>.
Well, i tried the following:

<input jwcid="schoolName@TextField" type="text"
value="ognl:site.school.name"	displayName="message:label.schoolname"
validators="validator:string,required" />

but when it does the rewind it throws an exception. i traced into the
source the string validator it creates is
org.apache.tapestry.valid.StringValidator which is correct except that
it implements IValidator and it gets cast to
org.apache.tapestry.form.validator.Validator which does not extend
IValidator. This looks like it might be a bug or I am doing something
wrong or both.

On Fri, 2005-09-16 at 20:11 +0200, Tomáš Drenčák wrote:
> Here's an simple example which uses required validator
> 
> @Component(type = "TextField", bindings = { "value=produkt.nazov",
> "validators=validators:required", "displayName=message:nazov" })
> public abstract TextField getNazov();
> 
> or
> 
> @Component(type = "TextField", bindings = { "value=kontakt.email",
> "validators=validators:email", "displayName=message:email" })
> public abstract TextField getEmail();
> 
> validator properties could be set by comma and parameter=value syntax 
> (validators:val, parameter=value)
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: docs for textfield

Posted by Tomáš Drenčák <to...@gmail.com>.
Here's an simple example which uses required validator

@Component(type = "TextField", bindings = { "value=produkt.nazov",
"validators=validators:required", "displayName=message:nazov" })
public abstract TextField getNazov();

or

@Component(type = "TextField", bindings = { "value=kontakt.email",
"validators=validators:email", "displayName=message:email" })
public abstract TextField getEmail();

validator properties could be set by comma and parameter=value syntax 
(validators:val, parameter=value)


2005/9/16, Dan Adams <da...@ifactory.com>:
> Well, the info there on the validator prefix is useful but even an
> example of using textfield would be great. i read the .jwc for the
> component but an example would very helpful.
> 
> On Fri, 2005-09-16 at 19:14 +0200, Tomáš Drenčák wrote:
> > There's short article about validation:
> > http://jakarta.apache.org/tapestry/UsersGuide/validation.html
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: docs for textfield

Posted by Dan Adams <da...@ifactory.com>.
Well, the info there on the validator prefix is useful but even an
example of using textfield would be great. i read the .jwc for the
component but an example would very helpful.

On Fri, 2005-09-16 at 19:14 +0200, Tomáš Drenčák wrote:
> There's short article about validation:
> http://jakarta.apache.org/tapestry/UsersGuide/validation.html
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: docs for textfield

Posted by Tomáš Drenčák <to...@gmail.com>.
There's short article about validation:
http://jakarta.apache.org/tapestry/UsersGuide/validation.html

2005/9/16, Dan Adams <da...@ifactory.com>:
> hey, are there any docs for the @textfield component on how to validate
> it as of T4? there aren't any in the component reference that comes with
> the source.
> 
> --
> Dan Adams
> Software Engineer
> Interactive Factory
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org