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

Safe HaskellNone

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 

Instances

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.

Instances

Functor FormResult 
Applicative FormResult 
Show a => Show (FormResult a) 
Monoid m => Monoid (FormResult m) 

type Env = Map Text [Text]Source

data Ints Source

Constructors

IntCons Int Ints 
IntSingle Int 

Instances

Show Ints 

Form

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

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

IsString (FieldSettings a) 

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 aSource

Arguments

 = Text

ID

-> Text

Name

-> [(Text, Text)]

Attributes

-> Either Text a

Either (invalid text) or (legitimate result)

-> Bool

Required?

-> WidgetT (HandlerSite m) IO ()