You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Syer <ds...@algorithmics.com> on 2005/08/17 14:34:27 UTC
Number validator in 4.0
Hi,
I must be missing something. I cannot see how to use the new validators=
framework to simply ensure that a TextField represents a number. There is
no validator in the forms/validate package that looks like to old "int"
validator in a ValidField.
I have successfully made a "required" validator reject a page with an empty
text field:
<component id="increment" type="TextField">
<binding name="validators" value="required" />
<binding name="clientValidationEnabled" value="true"/>
<binding name="displayName" value="message:increment" />
<binding name="value" value="wrapper.increment" />
</component>
and I can extend the validators binding to "required,maxLength=2" to accept
only two digits. But I cannot see how to reject an invalid number.
Also if the validators are "required,max=10" then the Max validator barfs
(ClassCastException). Is this a bug or am I dong something wrong?
By the way, I have tried adding a translators binding to the field viz:
<binding name="translators" value="translator:number" />
And this has no discernable effect.
Dave.
This email and any files transmitted with it are confidential and
proprietary to Algorithmics Incorporated and its affiliates
("Algorithmics"). If received in error, use is prohibited. Please destroy,
and notify sender. Sender does not waive confidentiality or privilege.
Internet communications cannot be guaranteed to be timely, secure, error or
virus-free. Algorithmics does not accept liability for any errors or
omissions. Any commitment intended to bind Algorithmics must be reduced to
writing and signed by an authorized signatory.
Re: Number validator in 4.0
Posted by Paolo DonĂ <pa...@gmail.com>.
I've done number validation this way :
<component type="TextField" id="cap">
<binding name="value" value="ognl:cap"/>
<binding name="displayName" value="literal:C.A.P."/>
<binding name="validators" value="validators:required,min=10000"/>
<binding name="translator" value="translator:number"/>
</component>
you used the binding name "translators" instead if "translator"
hope this help
Paolo
On 8/17/05, David Syer <ds...@algorithmics.com> wrote:
> Hi,
>
> I must be missing something. I cannot see how to use the new validators=
> framework to simply ensure that a TextField represents a number. There is
> no validator in the forms/validate package that looks like to old "int"
> validator in a ValidField.
>
> I have successfully made a "required" validator reject a page with an empty
> text field:
>
> <component id="increment" type="TextField">
> <binding name="validators" value="required" />
> <binding name="clientValidationEnabled" value="true"/>
> <binding name="displayName" value="message:increment" />
> <binding name="value" value="wrapper.increment" />
> </component>
>
> and I can extend the validators binding to "required,maxLength=2" to accept
> only two digits. But I cannot see how to reject an invalid number.
>
> Also if the validators are "required,max=10" then the Max validator barfs
> (ClassCastException). Is this a bug or am I dong something wrong?
>
> By the way, I have tried adding a translators binding to the field viz:
>
> <binding name="translators" value="translator:number" />
>
> And this has no discernable effect.
>
> Dave.
>
> This email and any files transmitted with it are confidential and
> proprietary to Algorithmics Incorporated and its affiliates
> ("Algorithmics"). If received in error, use is prohibited. Please destroy,
> and notify sender. Sender does not waive confidentiality or privilege.
> Internet communications cannot be guaranteed to be timely, secure, error or
> virus-free. Algorithmics does not accept liability for any errors or
> omissions. Any commitment intended to bind Algorithmics must be reduced to
> writing and signed by an authorized signatory.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Number validator in 4.0
Posted by Howard Lewis Ship <hl...@gmail.com>.
Correction:
<component id="editForm" type="Form">
<binding name="clientValidationEnabled" value="true"/>
</component>
<component id="orgName" type="TextField">
<binding name="value" value="ognl:organisation.name"/>
<binding name="validators" value="validators:string"/>
<binding name="displayName" value="ognl:'Name'"/>
</component>
The correct prefix is "validators:".
On 8/17/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> <component id="form" type="Form">
> <binding name="clientValidationEnabled" value="true"/>
> </component>
>
> <component id="increment" type="TextField">
> <binding name="validators" value="validators:required" />
> <binding name="displayName" value="message:increment" />
> <binding name="value" value="wrapper.increment" />
> </component>
>
> This is for beta-4. The validators: prefix is now necessary (if a bit
> repetative). clientValidationEnabled is a parameter of Form, not
> TextField.
>
> On 8/17/05, David Syer <ds...@algorithmics.com> wrote:
> > Hi,
> >
> > I must be missing something. I cannot see how to use the new validators=
> > framework to simply ensure that a TextField represents a number. There is
> > no validator in the forms/validate package that looks like to old "int"
> > validator in a ValidField.
> >
> > I have successfully made a "required" validator reject a page with an empty
> > text field:
> >
> > <component id="increment" type="TextField">
> > <binding name="validators" value="required" />
> > <binding name="clientValidationEnabled" value="true"/>
> > <binding name="displayName" value="message:increment" />
> > <binding name="value" value="wrapper.increment" />
> > </component>
> >
> > and I can extend the validators binding to "required,maxLength=2" to accept
> > only two digits. But I cannot see how to reject an invalid number.
> >
> > Also if the validators are "required,max=10" then the Max validator barfs
> > (ClassCastException). Is this a bug or am I dong something wrong?
> >
> > By the way, I have tried adding a translators binding to the field viz:
> >
> > <binding name="translators" value="translator:number" />
> >
> > And this has no discernable effect.
> >
> > Dave.
> >
> > This email and any files transmitted with it are confidential and
> > proprietary to Algorithmics Incorporated and its affiliates
> > ("Algorithmics"). If received in error, use is prohibited. Please destroy,
> > and notify sender. Sender does not waive confidentiality or privilege.
> > Internet communications cannot be guaranteed to be timely, secure, error or
> > virus-free. Algorithmics does not accept liability for any errors or
> > omissions. Any commitment intended to bind Algorithmics must be reduced to
> > writing and signed by an authorized signatory.
> >
> >
>
>
> --
> 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
>
--
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Number validator in 4.0
Posted by Howard Lewis Ship <hl...@gmail.com>.
<component id="form" type="Form">
<binding name="clientValidationEnabled" value="true"/>
</component>
<component id="increment" type="TextField">
<binding name="validators" value="validators:required" />
<binding name="displayName" value="message:increment" />
<binding name="value" value="wrapper.increment" />
</component>
This is for beta-4. The validators: prefix is now necessary (if a bit
repetative). clientValidationEnabled is a parameter of Form, not
TextField.
On 8/17/05, David Syer <ds...@algorithmics.com> wrote:
> Hi,
>
> I must be missing something. I cannot see how to use the new validators=
> framework to simply ensure that a TextField represents a number. There is
> no validator in the forms/validate package that looks like to old "int"
> validator in a ValidField.
>
> I have successfully made a "required" validator reject a page with an empty
> text field:
>
> <component id="increment" type="TextField">
> <binding name="validators" value="required" />
> <binding name="clientValidationEnabled" value="true"/>
> <binding name="displayName" value="message:increment" />
> <binding name="value" value="wrapper.increment" />
> </component>
>
> and I can extend the validators binding to "required,maxLength=2" to accept
> only two digits. But I cannot see how to reject an invalid number.
>
> Also if the validators are "required,max=10" then the Max validator barfs
> (ClassCastException). Is this a bug or am I dong something wrong?
>
> By the way, I have tried adding a translators binding to the field viz:
>
> <binding name="translators" value="translator:number" />
>
> And this has no discernable effect.
>
> Dave.
>
> This email and any files transmitted with it are confidential and
> proprietary to Algorithmics Incorporated and its affiliates
> ("Algorithmics"). If received in error, use is prohibited. Please destroy,
> and notify sender. Sender does not waive confidentiality or privilege.
> Internet communications cannot be guaranteed to be timely, secure, error or
> virus-free. Algorithmics does not accept liability for any errors or
> omissions. Any commitment intended to bind Algorithmics must be reduced to
> writing and signed by an authorized signatory.
>
>
--
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org