ditto-0.1.1.0: ditto is a type-safe HTML form generation and validation library

Safe HaskellNone
LanguageHaskell98

Ditto.Generalized.Named

Synopsis

Documentation

input :: (Monad m, FormError err) => (input -> Either err a) -> (FormId -> a -> view) -> a -> String -> Form m input err view a Source #

used for constructing elements like <input type="text">, which pure a single input value.

inputMaybe :: (Monad m, FormError err) => (input -> Either err a) -> (FormId -> a -> view) -> a -> String -> Form m input err view (Maybe a) Source #

used for elements like <input type="submit"> which are not always present in the form submission data.

inputNoData :: Monad m => (FormId -> a -> view) -> a -> String -> Form m input err view () Source #

used for elements like <input type="reset"> which take a value, but are never present in the form data set.

inputFile :: forall m input err view. (Monad m, FormInput input, FormError err, ErrorInputType err ~ input) => (FormId -> view) -> String -> Form m input err view (FileType input) Source #

used for <input type="file">

inputMulti Source #

Arguments

:: (Functor m, FormError err, ErrorInputType err ~ input, FormInput input, Monad m) 
=> [(a, lbl)]

value, label, initially checked

-> (FormId -> [(FormId, Int, lbl, Bool)] -> view)

function which generates the view

-> (a -> Bool)

isChecked/isSelected initially

-> String 
-> Form m input err view [a] 

used for groups of checkboxes, <select multiple="multiple"> boxes

inputChoice Source #

Arguments

:: (Functor m, FormError err, ErrorInputType err ~ input, FormInput input, Monad m) 
=> (a -> Bool)

is default

-> [(a, lbl)]

value, label

-> (FormId -> [(FormId, Int, lbl, Bool)] -> view)

function which generates the view

-> String 
-> Form m input err view a 

radio buttons, single <select> boxes

inputChoiceForms Source #

Arguments

:: (Functor m, Monad m, FormError err, ErrorInputType err ~ input, FormInput input) 
=> a 
-> [(Form m input err view a, lbl)]

value, label

-> (FormId -> [(FormId, Int, FormId, view, lbl, Bool)] -> view)

function which generates the view

-> String 
-> Form m input err view a 

radio buttons, single <select> boxes

label :: Monad m => (FormId -> view) -> String -> Form m input err view () Source #

used to create <label> elements

errors Source #

Arguments

:: Monad m 
=> ([err] -> view)

function to convert the err messages into a view

-> Form m input err view () 

used to add a list of err messages to a Form

This function automatically takes care of extracting only the errors that are relevent to the form element it is attached to via <++ or ++>.

childErrors :: Monad m => ([err] -> view) -> Form m input err view () Source #

similar to errors but includes err messages from children of the form as well.