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

Yesod.Form.Fields

Contents

- i18n
- Fields
- File `AForm`s
- Options

Synopsis

- data FormMessage
  - = MsgInvalidInteger Text
  - | MsgInvalidNumber Text
  - | MsgInvalidEntry Text
  - | MsgInvalidUrl Text
  - | MsgInvalidEmail Text
  - | MsgInvalidTimeFormat
  - | MsgInvalidHour Text
  - | MsgInvalidMinute Text
  - | MsgInvalidSecond Text
  - | MsgInvalidDay
  - | MsgCsrfWarning
  - | MsgValueRequired
  - | MsgInputNotFound Text
  - | MsgSelectNone
  - | MsgInvalidBool Text
  - | MsgBoolYes
  - | MsgBoolNo
  - | MsgDelete
- defaultFormMessage :: FormMessage -> Text
- textField :: RenderMessage master FormMessage => Field sub master Text
- passwordField :: RenderMessage master FormMessage => Field sub master Text
- textareaField :: RenderMessage master FormMessage => Field sub master Textarea
- hiddenField :: RenderMessage master FormMessage => Field sub master Text
- intField :: (Integral i, RenderMessage master FormMessage) => Field sub master i
- dayField :: RenderMessage master FormMessage => Field sub master Day
- timeField :: RenderMessage master FormMessage => Field sub master TimeOfDay
- htmlField :: RenderMessage master FormMessage => Field sub master Html
- emailField :: RenderMessage master FormMessage => Field sub master Text
- searchField :: RenderMessage master FormMessage => AutoFocus -> Field sub master Text
- selectField :: (Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master a
- multiSelectField :: (Show a, Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master [a]
- type AutoFocus = Bool
- urlField :: RenderMessage master FormMessage => Field sub master Text
- doubleField :: RenderMessage master FormMessage => Field sub master Double
- parseDate :: String -> Either FormMessage Day
- parseTime :: String -> Either FormMessage TimeOfDay
- newtype Textarea = Textarea {
  - unTextarea :: Text
  }
- radioField :: (Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master a
- boolField :: RenderMessage master FormMessage => Field sub master Bool
- fileAFormReq :: (RenderMessage master msg, RenderMessage master FormMessage) => FieldSettings msg -> AForm sub master FileInfo
- fileAFormOpt :: (RenderMessage master msg, RenderMessage master FormMessage) => FieldSettings msg -> AForm sub master (Maybe FileInfo)
- selectField' :: (Eq a, RenderMessage master FormMessage) => GGHandler sub master IO (OptionList a) -> Field sub master a
- radioField' :: (Eq a, RenderMessage master FormMessage) => GGHandler sub master IO (OptionList a) -> Field sub master a
- data Option a = Option {
  - optionDisplay :: Text
  - optionInternalValue :: a
  - optionExternalValue :: Text
  }
- data OptionList a = OptionList {
  - olOptions :: [Option a]
  - olReadExternal :: Text -> Maybe a
  }
- mkOptionList :: [Option a] -> OptionList a
- optionsPersist :: (YesodPersist master, PersistEntity a, PersistBackend (YesodPersistBackend master) (GGHandler sub master IO), SinglePiece (Key (YesodPersistBackend master) a)) => [Filter a] -> [SelectOpt a] -> (a -> Text) -> GGHandler sub master IO (OptionList (Key (YesodPersistBackend master) a, a))
- optionsPairs :: [(Text, a)] -> GGHandler sub master IO (OptionList a)
- optionsEnum :: (Show a, Enum a, Bounded a) => GGHandler sub master IO (OptionList a)

# i18n

data FormMessage

Constructors

MsgInvalidInteger Text |
MsgInvalidNumber Text |
MsgInvalidEntry Text |
MsgInvalidUrl Text |
MsgInvalidEmail Text |
MsgInvalidTimeFormat |
MsgInvalidHour Text |
MsgInvalidMinute Text |
MsgInvalidSecond Text |
MsgInvalidDay |
MsgCsrfWarning |
MsgValueRequired |
MsgInputNotFound Text |
MsgSelectNone |
MsgInvalidBool Text |
MsgBoolYes |
MsgBoolNo |
MsgDelete |

defaultFormMessage :: FormMessage -> Text

# Fields

textField :: RenderMessage master FormMessage => Field sub master Text

passwordField :: RenderMessage master FormMessage => Field sub master Text

textareaField :: RenderMessage master FormMessage => Field sub master Textarea

hiddenField :: RenderMessage master FormMessage => Field sub master Text

intField :: (Integral i, RenderMessage master FormMessage) => Field sub master i

dayField :: RenderMessage master FormMessage => Field sub master Day

timeField :: RenderMessage master FormMessage => Field sub master TimeOfDay

htmlField :: RenderMessage master FormMessage => Field sub master Html

emailField :: RenderMessage master FormMessage => Field sub master Text

searchField :: RenderMessage master FormMessage => AutoFocus -> Field sub master Text

selectField :: (Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master a

multiSelectField :: (Show a, Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master [a]

type AutoFocus = Bool

urlField :: RenderMessage master FormMessage => Field sub master Text

doubleField :: RenderMessage master FormMessage => Field sub master Double

parseDate :: String -> Either FormMessage Day

parseTime :: String -> Either FormMessage TimeOfDay

newtype Textarea

A newtype wrapper around a `String` that converts newlines to html br-tags.

Constructors

Textarea |

Fields

unTextarea :: Text

Instances

Eq Textarea |
Read Textarea |
Show Textarea |
ToHtml Textarea |
PersistField Textarea |
ToField Textarea master |
ToField (Maybe Textarea) master |

radioField :: (Eq a, RenderMessage master FormMessage) => [(Text, a)] -> Field sub master a

boolField :: RenderMessage master FormMessage => Field sub master Bool

# File `AForm`s

fileAFormReq :: (RenderMessage master msg, RenderMessage master FormMessage) => FieldSettings msg -> AForm sub master FileInfo

fileAFormOpt :: (RenderMessage master msg, RenderMessage master FormMessage) => FieldSettings msg -> AForm sub master (Maybe FileInfo)

# Options

selectField' :: (Eq a, RenderMessage master FormMessage) => GGHandler sub master IO (OptionList a) -> Field sub master a

radioField' :: (Eq a, RenderMessage master FormMessage) => GGHandler sub master IO (OptionList a) -> Field sub master a

data Option a

Constructors

Option |

Fields

optionDisplay :: Text
optionInternalValue :: a
optionExternalValue :: Text

data OptionList a

Constructors

OptionList |

Fields

olOptions :: [Option a]
olReadExternal :: Text -> Maybe a

mkOptionList :: [Option a] -> OptionList a

optionsPersist :: (YesodPersist master, PersistEntity a, PersistBackend (YesodPersistBackend master) (GGHandler sub master IO), SinglePiece (Key (YesodPersistBackend master) a)) => [Filter a] -> [SelectOpt a] -> (a -> Text) -> GGHandler sub master IO (OptionList (Key (YesodPersistBackend master) a, a))

optionsPairs :: [(Text, a)] -> GGHandler sub master IO (OptionList a)

optionsEnum :: (Show a, Enum a, Bounded a) => GGHandler sub master IO (OptionList a)