Safe Haskell | None |
---|---|
Language | Haskell98 |
Provides for getting input from either GET or POST params without generating HTML forms. For more information, see: http://www.yesodweb.com/book/forms#forms_kinds_of_forms.
- newtype FormInput m a = FormInput {
- unFormInput :: HandlerSite m -> [Text] -> Env -> FileEnv -> m (Either DText a)
- runInputGet :: MonadHandler m => FormInput m a -> m a
- runInputGetResult :: MonadHandler m => FormInput m a -> m (FormResult a)
- runInputPost :: MonadHandler m => FormInput m a -> m a
- runInputPostResult :: MonadHandler m => FormInput m a -> m (FormResult a)
- ireq :: (Monad m, RenderMessage (HandlerSite m) FormMessage) => Field m a -> Text -> FormInput m a
- iopt :: Monad m => Field m a -> Text -> FormInput m (Maybe a)
Documentation
Type for a form which parses a value of type a
with the base monad m
(usually your Handler
). Can can compose this using its Applicative
instance.
FormInput | |
|
runInputGet :: MonadHandler m => FormInput m a -> m a Source
Run a FormInput
on the GET parameters (i.e., query string). If parsing
fails, calls invalidArgs
.
runInputGetResult :: MonadHandler m => FormInput m a -> m (FormResult a) Source
Run a FormInput
on the GET parameters (i.e., query string). Does not
throw exceptions on failure.
Since 1.4.1
runInputPost :: MonadHandler m => FormInput m a -> m a Source
Run a FormInput
on the POST parameters (i.e., request body). If parsing
fails, calls invalidArgs
.
runInputPostResult :: MonadHandler m => FormInput m a -> m (FormResult a) Source
Run a FormInput
on the POST parameters (i.e., request body). Does not
throw exceptions on failure.
:: (Monad m, RenderMessage (HandlerSite m) FormMessage) | |
=> Field m a | |
-> Text | name of the field |
-> FormInput m a |
Promote a Field
into a FormInput
, requiring that the value be present
and valid.