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

Safe HaskellNone
LanguageHaskell98

Yesod.Form.Types

Contents

Synopsis

Helpers

data Enctype Source

The encoding type required by a form. The ToHtml instance produces values that can be inserted directly into HTML.

Constructors

UrlEncoded 
Multipart 

data FormResult a Source

A form can produce three different results: there was no data available, the data was invalid, or there was a successful parse.

The Applicative instance will concatenate the failure messages in two FormResults.

Constructors

FormMissing 
FormFailure [Text] 
FormSuccess a 

type Env = Map Text [Text] Source

type FileEnv = Map Text [FileInfo] Source

data Ints Source

Constructors

IntCons Int Ints 
IntSingle Int 

Instances

Form

type MForm m a = RWST (Maybe (Env, FileEnv), HandlerSite m, [Lang]) Enctype Ints m a Source

newtype AForm m a Source

Constructors

AForm 

Fields

unAForm :: (HandlerSite m, [Text]) -> Maybe (Env, FileEnv) -> Ints -> m (FormResult a, [FieldView (HandlerSite m)] -> [FieldView (HandlerSite m)], Ints, Enctype)
 

Instances

MonadTrans AForm 
Monad m => Functor (AForm m) 
Monad m => Applicative (AForm m) 
(Monad m, Monoid a) => Monoid (AForm m a) 

Build forms

data Field m a Source

Constructors

Field 

Fields

fieldParse :: [Text] -> [FileInfo] -> m (Either (SomeMessage (HandlerSite m)) (Maybe a))
 
fieldView :: FieldViewFunc m a
 
fieldEnctype :: Enctype
 

data FieldSettings master Source

Constructors

FieldSettings 

Fields

fsLabel :: SomeMessage master
 
fsTooltip :: Maybe (SomeMessage master)
 
fsId :: Maybe Text
 
fsName :: Maybe Text
 
fsAttrs :: [(Text, Text)]
 

Instances

data FieldView site Source

Constructors

FieldView 

Fields

fvLabel :: Markup
 
fvTooltip :: Maybe Markup
 
fvId :: Text
 
fvInput :: WidgetT site IO ()
 
fvErrors :: Maybe Markup
 
fvRequired :: Bool
 

type FieldViewFunc m a Source

Arguments

 = Text

ID

-> Text

Name

-> [(Text, Text)]

Attributes

-> Either Text a

Either (invalid text) or (legitimate result)

-> Bool

Required?

-> WidgetT (HandlerSite m) IO ()