[web-devel] Multi-selects for yesod-form in, let's keep rolling
michael at snoyman.com
Fri Jun 24 11:24:20 CEST 2011
David McBride has implemented multi-selects in yesod-form (way to
go!). This involves a breaking change to the API. So while we're
already breaking things, I wanted to get some discuss
dynamically-increasing forms in a more concrete way.
I've been playing around with a possible API, and came up with
something usable. You can see the result in Github:
. You can also see a usage example in the getMassR handler in the
For now, the basic idea is that you'll provide inputList with a label
for this set of fields, some way to convert the list of FieldViews
generated by the individual values into a widget, and a widget for a
single view. inputList will then create a single field in the larger
form, the will contain within it multiple subforms. Each subform will
have an option to delete it in addition to its normal contents. At the
end of the list of subforms, there is a checkbox to add an extra row.
My first use case for this is for creating pages in the Yesod wiki,
and I *think* it will work well for that case (though I haven't tried
it out yet to be sure). I wanted to get input from others about this,
since this is a complicated feature that could go in many different
directions. One thing to point out is that this API only addresses
applicative forms, not monadic forms.
More information about the web-devel