1

I'm using HTML::FormHandler (with DBIC) and I want to update a field on my model that depends on another field submitted on the form. HTML::FormHandler has a section on handling extra database fields, and it says when a row is created to do this in before update_model:

before 'update_model' => sub {
   my $self = shift;

   $self->item->my_other_column( manipulate_value($self->field('my_field') );
};

This works when I add a new item, but not when I edit it. When I edit the item my_field is updated but my_other_column is not. Does anyone know how I can accomplish this?

srchulo
  • 5,143
  • 4
  • 43
  • 72

1 Answers1

0

before 'update_model' works only when you add a new item.

From docs: If there is another database field that needs to be updated when a row is created, add an attribute to the form, and then process it with before 'update_model'.

Try around 'update_model'.

Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133