[html-formfu] use FormFu::Model::DBIC in Dancer2 app and populate select element in a form

Gert van Oss gertlist at mac.com
Mon Oct 1 11:43:05 GMT 2018


hello,

I’m using HTML::FormFu to generate forms for a small Dancer2 application. Creating the forms all works fine. While trying to experiment with HTML::FormFu::Model::DBIC I got lost.

With the code shown below the form is generated but the select element doesn’t show any values. Have I missed something?

Best regards,
Gert


The route in the Dancer2 App is:

————
get '/add-client' => sub {
   my $form = HTML::FormFu->new;
   $form->model('DBIC');
   $form->stash( schema => $schema );
   my $data = LoadFile('forms/addcountry.yml');
   $form->populate($data);
   template 'add-country' => { 'myform' => $form };
};
————

The addcountry.yml part where the element shows up is:

————
  - type: Block
     tag: tr
     attributes:
       id: country_id
     elements:
     - type: Block
       tag: td
       content_xml: "Land-code *"
       attributes:
         class: label
     - type: Block
       tag: td
       elements:
         type: Select
         name: "country_id"
         model_config:
           resultset: Country
————






More information about the HTML-FormFu mailing list