[html-formfu] Creating a new row automaticly (with Catalyst)

Carl Franks fireartist at gmail.com
Sun Sep 21 17:26:39 BST 2008


2008/9/20 Octavian Rasnita <orasnita at gmail.com>:
> Hi,
>
> I have read that it is possible to create  a new row automaticly from a
> form, without creating first the row then updating it.
>
> I have tried to do this with Catalyst, but it doesn't work. Here is what
> I've done:
>
> in MyApp.pm:
>
> __PACKAGE__->config(
>  'Controller::HTML::FormFu' => {
>   model_stash => {
>     schema => 'AccesDB',
>   },
>  },
> );
>
> In the form config:
>
> <model_config>
> resultset Domain
> </model_config>
>
> (And I have also tried
> resultset AccesDB::Domain
> but without any effect.)
>
> In the controller:
>
> if ($form->submitted_and_valid) {
> $form->model->update;
> }
>
> The result is that it gives the following error:
>
> Caught exception in MyApp::Controller::Domain->add "row object missing at
> e:/web/MyApp/lib/MyApp/Controller/Domain.pm line 12"
>
> Please tell me how it is possible to do this.


Hi Octavian,

Call create() instead of update()...

    $form->model->create;

Carl



More information about the HTML-FormFu mailing list