[web-devel] Caustom layouts for forms

Greg Weber greg at gregweber.info
Sun Mar 20 19:00:42 CET 2011

I have a single field form that uses the following code, hopefully it gives
you a good idea:

mkPersist [persist|
  term String

runSearchForm = do
  ((res, form), _) <- runFormMonadGet queryForm
  return (res, form)
    queryForm = do
      (term, queryField) <- searchField True "Search" Nothing
      return (Query <$> term, [hamlet| ^{fiInput queryField} |])

On Sun, Mar 20, 2011 at 10:52 AM, Michael Snoyman <michael at snoyman.com>wrote:

> On Sun, Mar 20, 2011 at 6:27 PM,  <vagif.verdi at gmail.com> wrote:
> > There are few utility functions like fieldsToTable that contsruct a form
> in
> > particular layout (one column table, divs etc.) But often we need to
> construct
> > a form with custom layout. How do i get individual rendered form fields
> (in a
> > list or map) to splice them into my template the way i see fit ?
> I apologize in advance for the vagueness of this email, I don't have
> time to give it a proper answer currently. Hopefully others can help
> flesh out the details until I have a bit more time to explain
> properly.
> The datatypes from yesod-form provide both an Applicative and a Monad
> interface. The Applicative interface gives you very terse code at the
> cost of constraining your output. Monad will require a bit more typing
> but gives you complete freedom of display.
> Michael
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110320/b4f080c6/attachment.htm>

More information about the web-devel mailing list