[html-formfu] Modify a submitted value before storing it in the database

onken at houseofdesign.de onken at houseofdesign.de
Thu Oct 9 08:52:04 BST 2008




On Thu, 9 Oct 2008 09:35:05 +0200, "Zbigniew Lukasiak" <zzbbyy at gmail.com>
wrote:
> On Wed, Oct 8, 2008 at 7:02 PM, Octavian Rasnita <orasnita at gmail.com>
> wrote:
>> Hi,
>>
>> I want to add a new user from a FormFu form, using:
>>
>> my $new_user = $c->model("DB::TempUser")->new_result({hash => $hash});
>>
>> $form->save_to_model($new_user);
>>
>> But before adding the elements of the form in the database, I want to
>> sha1_hex() the submitted password, which is one of the form fields.
>>
>> Please tell me what's the recommended way for doing this (and if the 2
> lines
>> above I use are the recommended way of inserting a new row in DB.)
> 
> TIMTOWTDI  - but one idea that worked for me in the past is to use a
> deflator in DBIC:
>
http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/InflateColumn.pm
> 
>

You might want to have a look at this module
http://search.cpan.org/perldoc?DBIx::Class::EncodedColumn

AFAIK $form->save_to_model is deprecated and will be removed.
Use $form->model->update instead.

greets,

moritz




More information about the HTML-FormFu mailing list