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

Wolfgang Kinkeldei wolfgang at kinkeldei.de
Wed Aug 19 06:29:04 GMT 2009


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

-- 

' /\_/\ ' .print[split??,"".(($/=q|Cms)+-03467:;<=|)=~tr!C-z -B! -z!)x
'( o.o )' .$/]->[hex]foreach split qr<>,qq+1ecd039ad65b025b8063475b+||
' > ^ < ' .q<!-- Wolfgang Kinkeldei - mailto:wolfgang at kinkeldei.de -->





-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090819/d1e09587/smime.bin


More information about the HTML-FormFu mailing list