[Catalyst] Setting data field to ''

Kevin White kevin at theconfused.co.uk
Sun Mar 19 01:44:39 CET 2006


Hi Folks,

I have a fairly standard CRUD set up for a SQLite DB with CDBI model  
on top with Class::DBI::FromForm. This is all fairly standard. The  
big problem I am having is a can't seem to clear any of the optional  
fields. When I try to clear them Class::DBI::FromForm does it stuff  
up to _run_update:

sub _run_update {
     my ( $me, $them, $results ) = @_;
     my @cols = ( $results->isa('HTML::Widget::Result') ?
         $results->valid :
         keys %{ $results->valid } );

     foreach my $col ( @cols ) {
         if ( $them->can($col) ) {
             next if $col eq $them->primary_column;
             if($results->isa('HTML::Widget::Result')) {
                 $them->$col( $results->param($col));
             } else {
                 #####
                 $them->$col( $results->valid($col));
                 #####
             }
         }
     }
     $them->update;
     return 1;
}

Trouble is whatever is getting submitted in the line marked with the  
comments doesn't seem to be triggering a set if the value in $results- 
 >valid($col) eq ''

Anyone seen this problem before... anyone point me in the direction  
of my stupidity?

Thanks for any help

Kevin




More information about the Catalyst mailing list