- class FormInput i f | i -> f where
- getInputString :: i -> Maybe String
- getInputStrings :: i -> [String]
- getInputText :: i -> Maybe Text
- getInputTexts :: i -> [Text]
- getInputFile :: i -> Maybe f
- inputString :: (Monad m, Functor m, FormInput i f) => (FormId -> Maybe String -> v) -> Maybe String -> Form m i e v String
- inputText :: (Monad m, Functor m, FormInput i f) => (FormId -> Maybe Text -> v) -> Maybe Text -> Form m i e v Text
- inputRead :: (Monad m, Functor m, FormInput i f, Read a, Show a) => (FormId -> Maybe String -> v) -> e -> Maybe a -> Form m i e v a
- inputBool :: (Monad m, Functor m, FormInput i f) => (FormId -> Bool -> v) -> Bool -> Form m i e v Bool
- inputChoice :: (Monad m, Functor m, FormInput i f, Monoid v, Eq a) => (FormId -> String -> Bool -> a -> v) -> a -> [a] -> Form m i e v a
- inputChoices :: (Monad m, Functor m, FormInput i f, Monoid v, Eq a) => (FormId -> String -> Bool -> a -> v) -> [a] -> [a] -> Form m i e v [a]
- inputFile :: (Monad m, Functor m, FormInput i f) => (FormId -> v) -> Form m i e v (Maybe f)
- inputList :: (Monad m, Monoid v) => Formlet m i e v Int -> Formlet m i e v a -> Formlet m i e v [a]
Documentation
class FormInput i f | i -> f whereSource
Class which all backends should implement. i
is here the type that is
used to represent a value uploaded by the client in the request
getInputString :: i -> Maybe StringSource
Parse the input into a string. This is used for simple text fields among other things
getInputStrings :: i -> [String]Source
Should be implemented
getInputText :: i -> Maybe TextSource
Parse the input value into Text
getInputTexts :: i -> [Text]Source
Can be overriden for efficiency concerns
getInputFile :: i -> Maybe fSource
Get a file descriptor for an uploaded file
:: (Monad m, Monoid v) | |
=> Formlet m i e v Int | A formlet for the list length |
-> Formlet m i e v a | The formlet for a single list element |
-> Formlet m i e v [a] | The dynamic list formlet |
Converts a formlet representing a single item into a formlet representing a dynamically sized list of those items. It requires that the user specify a formlet to hold the length of the list. Typically this will be a hidden field that is automatically updated by client-side javascript.
The field names must be generated as follows. Assume that if inputList had not been used, the field name would have been prefix-f5. In this case, the list length field name will be prefix-f5. The first item in the list will receive field names starting at prefix-f5.0.0. If each item is a composed form with two fields, those fields will have the names prefix-f5.0.0 and prefix-f5.0.1. The field names for the second item will be prefix-f5.1.0 and prefix-f5.1.1.