Parse forms (and query strings).
- data GForm sub y xml a
- data FormResult a
- = FormMissing
- | FormFailure [String]
- | FormSuccess a
- data Enctype
- = UrlEncoded
- | Multipart
- data FormFieldSettings = FormFieldSettings {}
- newtype Textarea = Textarea {
- unTextarea :: String
- type Form sub y = GForm sub y (GWidget sub y ())
- type Formlet sub y a = Maybe a -> Form sub y a
- type FormField sub y = GForm sub y [FieldInfo sub y]
- type FormletField sub y a = Maybe a -> FormField sub y a
- type FormInput sub y = GForm sub y [GWidget sub y ()]
- runFormGet :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)
- runFormPost :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)
- runFormGet' :: GForm sub y xml a -> GHandler sub y a
- runFormPost' :: GForm sub y xml a -> GHandler sub y a
- fieldsToTable :: FormField sub y a -> Form sub y a
- fieldsToPlain :: FormField sub y a -> Form sub y a
- checkForm :: (a -> FormResult b) -> GForm s m x a -> GForm s m x b
- mkToForm :: [EntityDef] -> Q [Dec]
- module Yesod.Form.Fields
- module Yesod.Form.Class
Data types
A generic form, allowing you to specifying the subsite datatype, master site datatype, a datatype for the form XML and the return type.
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
FormResult
s.
Functor FormResult | |
Applicative FormResult | |
Show a => Show (FormResult a) | |
Monoid m => Monoid (FormResult m) |
The encoding type required by a form. The Show
instance produces values
that can be inserted directly into HTML.
data FormFieldSettings Source
A newtype wrapper around a String
that converts newlines to HTML
br-tags.
Type synonyms
type FormletField sub y a = Maybe a -> FormField sub y aSource
Unwrapping functions
runFormGet :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)Source
Run a form against GET parameters.
runFormPost :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)Source
Run a form against POST parameters.
runFormGet' :: GForm sub y xml a -> GHandler sub y aSource
Run a form against GET parameters, disregarding the resulting HTML and returning an error response on invalid input.
runFormPost' :: GForm sub y xml a -> GHandler sub y aSource
Run a form against POST parameters, disregarding the resulting HTML and returning an error response on invalid input.
Field/form helpers
fieldsToTable :: FormField sub y a -> Form sub y aSource
Display the label, tooltip, input code and errors in a single row of a table.
fieldsToPlain :: FormField sub y a -> Form sub y aSource
Display only the actual input widget code, without any decoration.
checkForm :: (a -> FormResult b) -> GForm s m x a -> GForm s m x bSource
Add a validation check to a form.
Note that if there is a validation error, this message will not
automatically appear on the form; for that, you need to use checkField
.
Template Haskell
Re-exports
module Yesod.Form.Fields
module Yesod.Form.Class