digestive-functors-0.1.0.2: A general way to consume input using applicative functors

Text.Digestive.Forms.Html

Description

General functions for forms that are rendered to some sort of HTML

Synopsis

Documentation

data FormHtmlConfig Source

Settings for classes in generated HTML.

Constructors

FormHtmlConfig 

Fields

htmlInputClasses :: [String]

Classes applied to input elements

htmlSubmitClasses :: [String]

Classes applied to submit buttons

htmlLabelClasses :: [String]

Classes applied to labels

htmlErrorClasses :: [String]

Classes applied to errors

htmlErrorListClasses :: [String]

Classes for error lists

Instances

data FormEncType Source

Encoding type for the form

Constructors

UrlEncoded 
MultiPart 

data FormHtml a Source

HTML describing a form

Constructors

FormHtml 

Instances

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

mapViewHtmlSource

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

applyClassesSource

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