On 12/12/06, Igor Longagnani <[EMAIL PROTECTED]> wrote:
Hi,
i am a newbie with DBIx::Class and Catalyst so i beg your pardon in
advance for my question:

I do use with success DBIx::Class in other situations (easy ones) and
I am trying to populate the option fields of a "select tag" named
"soggetto" described through CGI::Formbuilder
with data selected from an Oracle DB via DBIx::Class/Catalyst webapp
runinng on catalyst developement server on port 3000.
This is what doesn't work, i mean syntax is correct but output not what
i excpected:

Inside a Catalyst Controller class:

my @data = $c->model('myDB::AnaEsercenti')->search(undef,{select =>
[qw/userid name/]})->all();
$c->form->options({ soggetto  => [EMAIL PROTECTED]);

You need to pass options() an arrayref of arrayrefs - you're passing
an arrayref of objects.

Something like this:

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

$c->form->options({ soggetto  => [EMAIL PROTECTED]);

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to