[html-formfu] How to have a null row in a select box?

Carl Franks fireartist at gmail.com
Wed Mar 11 17:05:55 GMT 2009


2009/3/11 Kaare Rasmussen <kaare at jasonic.dk>:
>> > In the config yml file I have this
>> >
>> >  - type: Select
>> >    name: parent_id
>> >    label: Parent
>> >    model_config:
>> >      resultset: Parents
>> >      id_column: id
>> >      label_column: label
>> >
>> > This is OK if we need an entry. But what if this should result in a null
>> > calue in the database, or an undef in Perl?
>>
>> Are you meaning a NULL value for the id_column or label_column,
>> or the resultset returning zero rows?
>
> If the Parents table has
> id      label
> 1       Mom
> 2       Dad
>
> I'd lke the select group to have three options,
> undef   <none>
> 1       Mom
> 2       Dad
>
> And be able to tell what the label of <none> should be. Is that possible?

Ah, yes.

    - type: Select
      name: parent_id
      empty_first: 1
      empty_first_label: 'none'

Cheers,
Carl



More information about the HTML-FormFu mailing list