[html-formfu] Repeatable block will not save records

Moritz Onken onken at houseofdesign.de
Wed Dec 31 08:16:30 GMT 2008


>
>
> sub formfu_edit :Local :FormConfig('prior/formfu_create.yml') {
>       my ($self, $c, $id) = @_;
>
>       # Get the specified book
>       my $book = $c->model('DB::Prior')->find($id);
>
>       # Make sure we were able to get a book
>       unless ($book) {
>           $c->flash->{error_msg} = "Invalid prior record -- Cannot  
> edit";
>           $c->response->redirect($c->uri_for('listprior'));
>           $c->detach;
>       }
>
>       # Get the form that the :FormConfig attribute saved in the stash
>       my $form = $c->stash->{form};
>
>       if ($form->submitted_and_valid) {
>
>           $form->save_to_model($book);


This should ne $form->model->update($book);
save_to_model is deprecated.
>
>
>   <Controller::HTML::FormFu>
>       <model_stash>
>           schema = ModelName
>       <model_stash>
>   </Controller::HTML::FormFu>

There are some typos in that part
correct (fixed in svn):

<Controller::HTML::FormFu>
<model_stash>
   schema ModelName
</model_stash>
</Controller::HTML::FormFu>


"ModelName" is the name you use when you call $c->model('ModelName')  
to access the model.

moritz



More information about the HTML-FormFu mailing list