2009/2/4 Dermot <paik...@googlemail.com>:
> Hi,
>
> Is it possible to set the 'selected' attribute on a option element?
> I have tried selected => 1 and selected => 'selected' but nether give
> me the effect.

Like any other field, you just need to call:
    $field->default( $value )

where $value == the selected option's value, not it's label.

To select multiple options, you need to set $field->multiple(1)

    type: Select
    name: foo
    multiple: 1

and give default() an arrayref of values.
    $field->default([ 1, 2, 3, 4 ]);

Carl

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to