[html-formfu] HTML::FormFu and many-to-many model

Carl Franks fireartist at gmail.com
Tue Apr 1 13:35:17 BST 2008


On 01/04/2008, Alex Povolotsky <tarkhil at over.ru> wrote:
> Zbigniew Lukasiak wrote:
>  > On Tue, Apr 1, 2008 at 12:13 PM, Alex Povolotsky <tarkhil at over.ru> wrote:
>  >
>  >> Zbigniew Lukasiak wrote:
>  >>  > On Mon, Mar 31, 2008 at 4:44 PM, Alex Povolotsky <tarkhil at over.ru> wrote:
>  >>  >
>  >>  >> Hello!
>  >>  >>
>  >>  >>  Can someone please provide me with working example of many_to_many
>  >>  >>  relationship with HTML::FormFu config file?...
>  >>  >>
>  >>  >
>  >>  > Have a look at the t directory :)
>  >>  >
>  >>
>  >>  Looked. Got some problems.
>  >>
>  >>  First of all, HTML::FormFu assumes that fields to join are named
>  >>  different in different tables.
>  >>
>  >>  For instance,
>  >>
>  >>  table alarm (alid primary key, name text)
>  >>  table abonent (abid primary key, name text)
>  >>  table a_to_a (alid references alarm(alid), abid references abonent(abid))
>  >>
>  >>  with standard DBIx::Class::Schema classes (autogenerated by Catalyst
>  >>  helper) yields
>  >>
>  >>  SELECT abid FROM a2a me  JOIN abonent abid ON ( abid.abid = me.abid )
>  >>  WHERE ( me.alid = ? ): '1'
>  >>
>  >>  which fails with error on Postgres.
>  >>
>  >>  Well, I've changed table definitions, and
>  >>
>  >>  (1) I do not understand how to specify text field
>  >>  (2) why do I get empty select and no attempt to extract anything from
>  >>  abonents table
>  >>
>  >>
>  >
>  > Please try to write a test case - this looks like an important bug -
>  > but it's very hard to guess what is really failing.  First verify it
>  > if is really a PostgreSQL thing - check if the same schema works in
>  > SQLite.
>  > \
>
> Well, I've added print $form->render to
>  t/defaults_from_model/many_to_many_select.t

There's been a lot of changes since the last CPAN release.
The most recent code is now in:
https://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Model-DBIC
and there's no longer a "t/defaults_from_model" directory - it's
"t/options_from_model"

I added a `print $form` in many_to_many_select.t _after_ the call to
$form->process() and it printed as expected.

Carl



More information about the HTML-FormFu mailing list