[Catalyst] Empty strings and FormValidator
Michael Reece
mreece at sacbee.com
Tue Apr 19 19:07:07 CEST 2005
Well, not exactly .. That puts the 'missing' optional fields back into valid
as undef, but Class::DBI::FromForm's _run_update only sets $them->$col($val)
if the value is defined ..
I am still open to suggestions on how to get these packages to play nice
together, if someone else has already solved this problem.
On 4/19/05 10:03 AM, "Michael Reece" <mreece at sacbee.com> wrote:
> Nevermind, I found the 'missing_optional_valid => 1' option.
>
> On 4/19/05 9:55 AM, "Michael Reece" <mreece at sacbee.com> wrote:
>
>> Using Catalyst::Plugin::FormValidator and Class::DBI::FromForm, I noticed
>> that 'cleared' values (empty string) are not saved.
>>
>> This is because Data::FormValidator->check deletes empty values from the
>> 'valid' hash:
>>
>> (in Data/FormValidator/Results.pm, sub _process)
>>
>> delete $valid{$field} unless (defined $valid{$field} and length
>> $valid{$field});
>>
>> so these cleared fields are never updated by update_from_form.
>>
>> Has anyone dealt with this problem or have suggestions?
>>
>>
>>
>> _______________________________________________
>> Catalyst mailing list
>> Catalyst at lists.rawmode.org
>> http://lists.rawmode.org/mailman/listinfo/catalyst
>>
--
michael reece :: web engineer :: mreece at sacbee.com :: (916)321-1249
More information about the Catalyst
mailing list