[Catalyst] HTML::Widget: "All" Constraint and fields containing '0'

Michele Beltrame mb at italpro.net
Thu Mar 23 17:15:01 CET 2006


Hello!

I noticed a behaviour that might be buggy in HTML::Widget, which I use
for form validation. I have a constraint such as this:

    $w->constraint('All', qw/active username idrole/)->message(
        'il campo non può essere vuoto'
    );

The "active" comes from the form with either a '0' or a '1' and, if it's
'1' the costraint check is passed, but if it's '0' is isn't. That is, a
'0' is treated like an empty string. But it's not an empty string, it's
a '0'. Is that the right behaviour? If it is, how can I make sure a
field IS filled in if a zero is a valid field value for me?

Thanks,
Michele.

-- 
Michele Beltrame
http://www.varlogarthas.net/
ICQ# 76660101
Informativa privacy: http://www.italpro.net/em.html



More information about the Catalyst mailing list