Date: | Tue, 2 Dec 2003 09:38:37 -0500 |
From: | Mark Stosberg <mark [...] summersault.com> |
To: | Adam Thick <adam.thick [...] strategicdata.com.au> |
CC: | cascade-dataform [...] lists.sourceforge.net |
Subject: | Re: [dfv] zero and constraints |
On Tue, Dec 02, 2003 at 10:38:37AM +1100, Adam Thick wrote:
Show quoted text
> Hi I've been happily using Data::FormValidator in conjuction with
> CGI::App. I've encountered a problem when I submit a value from a form,
> using a constraint like
>
> 'BLAH' => {
> name => 'number',
> constraint => qr/^\d+$/,
> },
>
> if the value is 0, it passes the constraint but is then rejected
> somewhere in FormValidator and brings me back to my form screen with my
> error message 'this is not a valid number'
>
> 00 works and is passed through fine...
>
> letters and other characters are rejected which you would expect so I
> can only assume that 0 causes Data::FormValidator to fail on some test
> internally?
Thanks for the report. I've submitted this to the bug tracking system
and will look into it.
If someone else wants to look into it more and/or write a formal test
case for it, that would be helpful. :)
Since we are already requiring Regexp::Common, perhaps I should just
make "number" an alias to Regexp::Common RE, which I can only imagine
will be more thorough and better tested.
In the meantime, you might want to just use one of the Regexp::Common
functions directly. Maybe you want:
RE_num_int
See Regexp::Common::number for more options.
Mark
--
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Mark Stosberg Principal Developer
mark@summersault.com Summersault, LLC
765-939-9301 ext 202 database driven websites
. . . . . http://www.summersault.com/ . . . . . . . .