You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cucchietti Denis <de...@atosorigin.com> on 2010/08/19 09:36:01 UTC

Problem with comma and Integer in textfield

Hi !!

First sorry for my poor english ;-). I have decided to ask some help for a
problem of comma in textfield.


I have an attribute "budget" :

 private Integer budget;

In TML, i have :

 <t:label for="budget">${message:budget-label} :</t:label>
 <t:textfield t:id="budget" t:value="organism.budget" t:maxlength="9" t:validate="regexp"/>

So i have a regexp because i just want an integer :

budget-regexp=^[0-9]{1,9}$

It works but it is always possible to insert a comma in the textfield !!

How can i do to forbid this comma? (because in France if you insert a comma
is for a float)

If someone has an idea :-)

Thanks !!!!

Denis CUCCHIETTI
Responsable d'application
Business Unit Public Santé Transport
Atos Worldline - Lyon
Mail : denis.cucchietti@atosorigin.com
Tel : +33 (0)4 78 17 87 86
www.atosworldline.com<blocked::http://www.atosworldline.com>
Atos Worldline est une société du groupe Atos Origin : www.atosorigin.com<blocked::http://www.atosorigin.com>



________________________________

Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.

RE: Problem with comma and Integer in textfield

Posted by Cucchietti Denis <de...@atosorigin.com>.
Hi Donny!

First of all thanks for your answer.

I've chosen the first option. I've declared a String and used the regex and its works fine ;-).

Thanks!

-----Message d'origine-----
De : Donny Nadolny [mailto:donny.nadolny@gmail.com]
Envoyé : vendredi 27 août 2010 03:07
À : Tapestry users
Objet : Re: Problem with comma and Integer in textfield

This seems like a bug to me. I tried it out, and if you have an
Integer then Tapestry automatically adds the numericformat validator,
but ignores the regex validation you gave (the regex worked when I
tried a different one, eg ^a+$, just not the one you gave). If you
change your code to be private String budget, the regex works.

So you have two options:
Change it to be a String and Integer.parseInt it, or:
Set your JVM Locale to be french (jvm argument -Duser.language=fr) and
Tapestry's numericformat validator will validate numbers properly for
you (commas count as decimals which are invalid), and you don't need
the regex.


On Thu, Aug 19, 2010 at 3:36 AM, Cucchietti Denis
<de...@atosorigin.com> wrote:
> Hi !!
>
> First sorry for my poor english ;-). I have decided to ask some help for a
> problem of comma in textfield.
>
>
> I have an attribute "budget" :
>
>  private Integer budget;
>
> In TML, i have :
>
>  <t:label for="budget">${message:budget-label} :</t:label>
>  <t:textfield t:id="budget" t:value="organism.budget" t:maxlength="9" t:validate="regexp"/>
>
> So i have a regexp because i just want an integer :
>
> budget-regexp=^[0-9]{1,9}$
>
> It works but it is always possible to insert a comma in the textfield !!
>
> How can i do to forbid this comma? (because in France if you insert a comma
> is for a float)
>
> If someone has an idea :-)
>
> Thanks !!!!
>
> Denis CUCCHIETTI
> Responsable d'application
> Business Unit Public Santé Transport
> Atos Worldline - Lyon
> Mail : denis.cucchietti@atosorigin.com
> Tel : +33 (0)4 78 17 87 86
> www.atosworldline.com<blocked::http://www.atosworldline.com>
> Atos Worldline est une société du groupe Atos Origin : www.atosorigin.com<blocked::http://www.atosorigin.com>
>
>
>
> ________________________________
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
>

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




Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


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


Re: Problem with comma and Integer in textfield

Posted by Donny Nadolny <do...@gmail.com>.
This seems like a bug to me. I tried it out, and if you have an
Integer then Tapestry automatically adds the numericformat validator,
but ignores the regex validation you gave (the regex worked when I
tried a different one, eg ^a+$, just not the one you gave). If you
change your code to be private String budget, the regex works.

So you have two options:
Change it to be a String and Integer.parseInt it, or:
Set your JVM Locale to be french (jvm argument -Duser.language=fr) and
Tapestry's numericformat validator will validate numbers properly for
you (commas count as decimals which are invalid), and you don't need
the regex.


On Thu, Aug 19, 2010 at 3:36 AM, Cucchietti Denis
<de...@atosorigin.com> wrote:
> Hi !!
>
> First sorry for my poor english ;-). I have decided to ask some help for a
> problem of comma in textfield.
>
>
> I have an attribute "budget" :
>
>  private Integer budget;
>
> In TML, i have :
>
>  <t:label for="budget">${message:budget-label} :</t:label>
>  <t:textfield t:id="budget" t:value="organism.budget" t:maxlength="9" t:validate="regexp"/>
>
> So i have a regexp because i just want an integer :
>
> budget-regexp=^[0-9]{1,9}$
>
> It works but it is always possible to insert a comma in the textfield !!
>
> How can i do to forbid this comma? (because in France if you insert a comma
> is for a float)
>
> If someone has an idea :-)
>
> Thanks !!!!
>
> Denis CUCCHIETTI
> Responsable d'application
> Business Unit Public Santé Transport
> Atos Worldline - Lyon
> Mail : denis.cucchietti@atosorigin.com
> Tel : +33 (0)4 78 17 87 86
> www.atosworldline.com<blocked::http://www.atosworldline.com>
> Atos Worldline est une société du groupe Atos Origin : www.atosorigin.com<blocked::http://www.atosorigin.com>
>
>
>
> ________________________________
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.
>
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
>

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