Text.Digestive.Forms.Html
Description
General functions for forms that are rendered to some sort of HTML
- data FormHtmlConfig = FormHtmlConfig {
- htmlInputClasses :: [String]
- htmlSubmitClasses :: [String]
- htmlLabelClasses :: [String]
- htmlErrorClasses :: [String]
- htmlErrorListClasses :: [String]
- data FormEncType
- = UrlEncoded
- | MultiPart
- data FormHtml a = FormHtml {
- formEncType :: FormEncType
- formHtml :: FormHtmlConfig -> a
- createFormHtml :: (FormHtmlConfig -> a) -> FormHtml a
- createFormHtmlWith :: FormEncType -> (FormHtmlConfig -> a) -> FormHtml a
- viewHtml :: Monad m => a -> Form m i e (FormHtml a) ()
- mapViewHtml :: (Monad m, Functor m) => (v -> w) -> Form m i e (FormHtml v) a -> Form m i e (FormHtml w) a
- applyClasses :: (a -> String -> a) -> [FormHtmlConfig -> [String]] -> FormHtmlConfig -> a -> a
- defaultHtmlConfig :: FormHtmlConfig
- emptyHtmlConfig :: FormHtmlConfig
- renderFormHtml :: FormHtml a -> (a, FormEncType)
- renderFormHtmlWith :: FormHtmlConfig -> FormHtml a -> (a, FormEncType)
Documentation
data FormHtmlConfig Source
Settings for classes in generated HTML.
Constructors
FormHtmlConfig | |
Fields
|
Instances
HTML describing a form
Constructors
FormHtml | |
Fields
|
createFormHtml :: (FormHtmlConfig -> a) -> FormHtml aSource
Create form HTML with the default encoding type
createFormHtmlWith :: FormEncType -> (FormHtmlConfig -> a) -> FormHtml aSource
Create form HTML with a custom encoding type
viewHtml :: Monad m => a -> Form m i e (FormHtml a) ()Source
A shortcut for inserting HTML to the view, defined as a combination of
view
and createFormHtml
Arguments
:: (Monad m, Functor m) | |
=> (v -> w) | Map over the contained HTML |
-> Form m i e (FormHtml v) a | Initial form |
-> Form m i e (FormHtml w) a | Resulting form |
Lifted version of mapView
Arguments
:: (a -> String -> a) | Apply the class attribute |
-> [FormHtmlConfig -> [String]] | Labels to apply |
-> FormHtmlConfig | Label configuration |
-> a | HTML element |
-> a | Resulting element |
Apply all classes to an HTML element. If no classes are found, nothing happens.
defaultHtmlConfig :: FormHtmlConfigSource
Default configuration
emptyHtmlConfig :: FormHtmlConfigSource
Empty configuration (no classes are set)
renderFormHtml :: FormHtml a -> (a, FormEncType)Source
Render FormHtml using the default configuration
renderFormHtmlWith :: FormHtmlConfig -> FormHtml a -> (a, FormEncType)Source
Render FormHtml using a custom configuration