[html-formfu] Multiple columns for a Select element?

Ascii King tech at swattermatter.com
Wed Aug 19 15:03:36 GMT 2009


Thanks for the reply, Wolfgang. It is exactly what I was looking for.

Wolfgang Kinkeldei wrote:
> Hi,
>
> Am 18.08.2009 um 19:59 schrieb Ascii King:
>
>> Is it opossible to display multiple columns in a Select element? I 
>> have looked and can't find it in the documentation.
>
> The YAML definition of a form only allows the specification of a 
> single column name.
>
> However, you could add an accessor into one of your Result classes to 
> get the text you like to expect as a label for the Select element. To 
> avoid lots of trivial selects you should add a 'prefetch' attribute 
> into the model config like the example below if the columns involved 
> sit in different tables.
>
> <snip>
> # in my Result::Info I concatenate the name of a foreign table 
> 'infokind' with name
> sub description {
>     $_[0]->infokind->name . ' / ' . $_[0]->name;
> }
>
> # in my form.yml I can simply use it...
> - type: Select
>   ...
>   model_config:
>     resultset: Info
>     label_column: description
>     attributes:
>       prefetch: infokind
> ...
> <snap>
>
>
> Regards,
>
> Wolfgang Kinkeldei
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu



More information about the HTML-FormFu mailing list