[Dbix-class] DBIX::Class - CGI::FormBuilder select-options problem

Tobias Kremer t at funkreich.de
Tue Dec 12 13:25:56 GMT 2006


Zitat von Igor Longagnani <i.longagnani at synervis.it>:
> Inside a Catalyst Controller class:
>
> my @data = $c->model('myDB::AnaEsercenti')->search(undef,{select =>
> [qw/userid name/]})->all();
> $c->form->options({ soggetto  => \@data});

The Catalyst::Plugin::FormBuilder POD gives an example for this (see section
DESCRIPTION). This should probably work (untested!):

$c->form->options(
  [
    map {
      [ $_->userid, $_->name ]
    } $c->model('myDB::AnaEsercenti')->search(
      undef, {
        select => [ qw/userid name/ ]
      }
    )->all()
  ]
);

HTH

-- Tobias



More information about the Dbix-class mailing list