[html-formfu] Populating $form_input with 'select' element options?

Carl Franks fireartist at gmail.com
Sat Nov 5 22:35:44 GMT 2011


On 4 November 2011 19:24, J. Bobby Lopez <jbl at jbldata.com> wrote:
> I also see that when I dump %cgivars after submitting a form with
> multiple values selected in a 'select' element, that the values become
> concatenated.
>
> E.g (FormFu yml):
>
>    - type: Select
>      name: EmailDL
>      label: 'Subscribed Lists:'
>      options:
>        - [ 'male', 'Male' ]
>        - [ 'female', 'Female' ]
>
>
> And resulting params (%cgivars):
>   {
>          ...,
>          'EmailDL' => 'malefemale',
>          ...,
>   }
>
>
> So I'm not sure how FormFu would deal with multi-valued selects in general?

Hi,
I've just committed test files checking that multi-value selects work.
Setting default with $field->default(\@values), and submitting multiple values:
https://github.com/fireartist/HTML-FormFu/blob/master/t/elements/select_multi_value.t
Setting default with $form->default_values({ name => \@values });
https://github.com/fireartist/HTML-FormFu/blob/master/t/elements/select_multi_default_values.t
Everything seems to work as expected.

I'm not sure where your %cgivars comes from - and whether you're using
CGI, CGI::Simple or Catalyst?

Carl



More information about the HTML-FormFu mailing list