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) ()
- 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.
FormHtmlConfig | |
|
data FormEncType Source
Encoding type for the form
HTML describing a form
FormHtml | |
|
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
:: (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