<div><div>I have a single field form that uses the following code, hopefully it gives you a good idea:</div><div><br></div><div>mkPersist [persist|</div><div>Query</div><div> term String</div><div>|]</div></div><div><br></div>
<div>runSearchForm = do</div><div> ((res, form), _) <- runFormMonadGet queryForm</div><div> return (res, form)</div><div> where</div><div> queryForm = do</div><div> (term, queryField) <- searchField True "Search" Nothing</div>
<div> return (Query <$> term, [hamlet| ^{fiInput queryField} |])</div><br><div class="gmail_quote">On Sun, Mar 20, 2011 at 10:52 AM, Michael Snoyman <span dir="ltr"><<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Sun, Mar 20, 2011 at 6:27 PM, <<a href="mailto:vagif.verdi@gmail.com">vagif.verdi@gmail.com</a>> wrote:<br>
> There are few utility functions like fieldsToTable that contsruct a form in<br>
> particular layout (one column table, divs etc.) But often we need to construct<br>
> a form with custom layout. How do i get individual rendered form fields (in a<br>
> list or map) to splice them into my template the way i see fit ?<br>
<br>
</div>I apologize in advance for the vagueness of this email, I don't have<br>
time to give it a proper answer currently. Hopefully others can help<br>
flesh out the details until I have a bit more time to explain<br>
properly.<br>
<br>
The datatypes from yesod-form provide both an Applicative and a Monad<br>
interface. The Applicative interface gives you very terse code at the<br>
cost of constraining your output. Monad will require a bit more typing<br>
but gives you complete freedom of display.<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
</div></div></blockquote></div><br>