Digestive-functors-blaze creates html like <input type="text" id="foo" name="foo" /><label for="foo">Bar</label>
, but I didn't find any standard way to for example add <br />
to the end.
I came up with this:
br :: (Monad m) => HappstackForm m H.Html BlazeFormHtml ()
br = Common.label $ \_ -> do
createFormHtml $ \cfg -> do
H.br
I can append it with <++
which does what I expect it to, but I wonder whether this is the intended way?
Also how would this extend with for example fieldsets.
This is the intended way, although
br
would be a little cleaner when written as:Anyway, I figured this definition is a little cumbersome so I added a
viewHtml
function toText.Digestive.Forms.Html
:This is available in digestive-functors-0.1.0.1. Using this new combinator, you should be able to just use
<++ viewHtml H.br
— I hope this helps.