[html-formfu] combo box equivalent

Malcolm mjh-formfu at liminalflux.net
Mon Sep 8 02:55:15 BST 2008


On Friday 05 September 2008, Carl Franks wrote:

> I've added a new ComboBox element.
>
> You can build it just as you would a Select field, using options(),
> values() or value_range() - but under the hood it's really a Multi
> element, like the Date field.
>
>     type: ComboBox
>     name: foo
>     values: [yes, no]

It looks good. :-)

> If you both select an option from the Select menu *and* fill in the
> text field, it'll only use the value from the text field.

I wonder if it should (have the option to) throw an error if they are 
different. So the form could go back to the user with a "which did you mean?"
I'm not sure if that makes sense from a useability perspective though.

> I haven't yet put it into use in a real application, though I hope to
> do so in the next week. - Let me know if you come across any problems,
> or can think of any more tests I've missed.

The only thing I've run into is trying to set the options list 
programmatically. Calling $element->options doesn't seem to have an effect as 
the form is already created (via FormConfig) from the yml. 

Is it possible to use a callback to set the list of options? Looking at the 
code it doesn't look like it currently, but it doesn't seem like it would be 
too difficult. If I get time away from the day job, I'll see if I can put a 
patch together.



More information about the HTML-FormFu mailing list