From gertlist at mac.com Mon Oct 1 11:43:05 2018 From: gertlist at mac.com (Gert van Oss) Date: Mon, 01 Oct 2018 13:43:05 +0200 Subject: [html-formfu] use FormFu::Model::DBIC in Dancer2 app and populate select element in a form Message-ID: 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 ???? From gertlist at mac.com Mon Oct 1 13:40:11 2018 From: gertlist at mac.com (Gert van Oss) Date: Mon, 01 Oct 2018 15:40:11 +0200 Subject: [html-formfu] use FormFu::Model::DBIC in Dancer2 app and populate select element in a form In-Reply-To: References: Message-ID: okay, answering my own question after again reading through: https://metacpan.org/pod/HTML::FormFu::Model::DBIC The code below works get '/add-client' => sub { my $form = HTML::FormFu->new; $form->load_config_file("forms/addclient.yml"); $form->model('DBIC'); $form->stash( schema => $schema ); $form->process; template 'add-client' => { '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 label_column: "country" > On Oct 1, 2018, at 13:43PM, Gert van Oss wrote: > > 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 > ???? > > > > > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu at lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu -------------- next part -------------- An HTML attachment was scrubbed... URL: