yesod-form-1.4.5: Form handling support for Yesod Web Framework

Safe HaskellNone
LanguageHaskell98

Yesod.Form.Input

Description

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.

Synopsis

Documentation

newtype FormInput m a Source

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.

Constructors

FormInput 

Fields

unFormInput :: HandlerSite m -> [Text] -> Env -> FileEnv -> m (Either DText a)
 

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.

ireq Source

Arguments

:: (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.

iopt :: Monad m => Field m a -> Text -> FormInput m (Maybe a) Source

Promote a Field into a FormInput, with its presence being optional. If the value is present but does not parse correctly, the form will still fail.