[html-formfu] model_stash + model_config with ComboBox element

Carl Franks fireartist at gmail.com
Tue Jan 27 14:07:10 GMT 2009


2009/1/27 Jens Schwarz <blacky6767 at gmx.de>:
> Hi,
>
> some weeks ago Carl gave me this useful hint (see below) for populating Select elements. Works fine with Select elements. Now I tried to adopt this for my ComboBox but failed (just think of the example below being a ComboBox instead of a Select): The result is that when I call the edit action in my Catalyst controller, the genre saved in the recordset is displayed in the genres_text part of the ComboBox - even if the genre would be available in genres_select.

Hi Jens,

Say the select part of a ComboBox has the following options:
[ 1 => 'One',
  2 => 'Two',
  3 => 'Three',
]
To have the ComboBox select the correct item, you need to do, for example:
    $combobox->default( 2 );
and not
    $combobox->default( 'Two' );

Could that be the problem?
I can't tell from your description, whether you're using Model::DBIC's
default_values(), or whether you're setting it yourself - so can't
really advise further how to fix it.

Carl



More information about the HTML-FormFu mailing list