fn-extra-0.3.0.0: Extras for Fn, a functional web framework.

Safe HaskellNone
LanguageHaskell2010

Web.Fn.Extra.Digestive

Synopsis

Documentation

runForm :: RequestContext ctxt => ctxt -> Text -> Form v IO a -> ((View v, Maybe a) -> IO a1) -> IO a1 Source

This function runs a form and passes the function in it's last argument the result, which is a View and an optional result. If the request is a get, or if the form failed to validate, the result will be Nothing and you should render the form (with the errors from the View).

WARNING: If you have already parsed the request body with !=> (even if the route didn't end up matching), this will _only_ get post parameters, it will not see any files that were posted. This is a current implementation limitation that will (hopefully) be resolved eventually, but for now, it is safest to just never use !=> if you are using digestive functors (as the expectation is that it will be handling all your POST needs!).