You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by defe <de...@free.fr> on 2004/08/30 21:33:12 UTC

CForms validation integers

hi,

How can i simply make sure a user will only input numeric characters
in a text field?

it does not completely works with the following:

<fd:field id="foo" required="true">
    <fd:label>foo</fd:label>
    <fd:datatype base="integer"/>
</fd:field>

thanks


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


Re: CForms validation integers

Posted by de...@free.fr.
Quoting Superbiji <su...@gmail.com>:

> What's the error message?
>
> On Mon, 30 Aug 2004 21:33:12 +0200, defe <de...@free.fr> wrote:
> > hi,
> >
> > How can i simply make sure a user will only input numeric characters
> > in a text field?
> >
> > it does not completely works with the following:
> >
> > <fd:field id="foo" required="true">
> >     <fd:label>foo</fd:label>
> >     <fd:datatype base="integer"/>
> > </fd:field>
> >
> > thanks
> >

there's no error. i just noticed "1A" is not detected as a bad number, whereas
"A1" is.
So, do i need a specific validator to make sure i only get integers?

thanks



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


Re: CForms validation integers

Posted by Superbiji <su...@gmail.com>.
What's the error message?

On Mon, 30 Aug 2004 21:33:12 +0200, defe <de...@free.fr> wrote:
> hi,
> 
> How can i simply make sure a user will only input numeric characters
> in a text field?
> 
> it does not completely works with the following:
> 
> <fd:field id="foo" required="true">
>     <fd:label>foo</fd:label>
>     <fd:datatype base="integer"/>
> </fd:field>
> 
> thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

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


Re: CForms validation integers

Posted by Karel Vervaeke <ka...@telenet.be>.
I have no idea why "1A" is a valid number, but
maybe you could work around it by including a regexp validator

<fd:validation>

  <fd:regexp pattern="[0-9]*">
     <fd:failmessage>Numbers only please!</fd:failmessage>
  </fd:regexp>
</fd:validation>

Greetings,
Karel

defe wrote:

> hi,
>
> How can i simply make sure a user will only input numeric characters
> in a text field?
>
> it does not completely works with the following:
>
> <fd:field id="foo" required="true">
>    <fd:label>foo</fd:label>
>    <fd:datatype base="integer"/>
> </fd:field>
>
> thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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