[html-formfu] FormFu many_to_many YAML declaration

Robyn Jonahs learn.catalyst at gmail.com
Wed Apr 11 17:29:26 GMT 2012

(Also sent to the Catalyst list - sorry if this is cross posting breach of


I am having trouble with understanding how to get Many to Many
relationships into a FormFu form via YAML.

Consider the tutorial example...

The authors are placed into a select element.

    } else {
        # Get the authors from the DB
        my @author_objs =3D $c->model("DB::Author")->all();
        # Create an array of arrayrefs where each arrayref is an author
        my @authors;
        foreach (sort {$a->last_name cmp $b->last_name} @author_objs) {
            push(@authors, [$_->id, $_->last_name]);
        # Get the select added by the config file
        my $select =3D $form->get_element({type =3D> 'Select'});
        # Add the authors to it

and then in the form set up config

    - type: Select
      name: authors
      label: Author

What if I don't want the authors in a select field but a text field? Can I
do that?

I have been trying to use something like in

but that example schema set does not have the "many-to-many join table
between books & authors" as in the tutorial.

I can't figure out how to write the YAML to get FormFu to put the data into
my edit form while using the many to many join table. Can anyone help out?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20120411/1e=

More information about the HTML-FormFu mailing list