| Safe Haskell | None |
|---|
SimpleForm.Combined
Description
Forms that configure themselves based on type
The Combined module both renders to Html and also parses input.
- type Widget a = Maybe a -> Maybe Text -> Text -> InputOptions -> Input
- class DefaultWidget a where
- data Validation a
- = Check ([Text] -> Maybe a)
- | Includes (GroupedCollection' a)
- class DefaultValidation a where
- vdef :: Validation a
- vdefList :: Validation [a]
- data InputOptions = InputOptions {
- label :: Maybe Label
- hint :: Maybe Text
- required :: Bool
- disabled :: Bool
- input_html :: [(Text, Text)]
- label_html :: [(Text, Text)]
- error_html :: [(Text, Text)]
- hint_html :: [(Text, Text)]
- wrapper_html :: [(Text, Text)]
- data Label
- = Label Text
- | InlineLabel Text
- | DefaultLabel
- newtype ShowRead a = ShowRead a
- unShowRead :: ShowRead a -> a
- newtype SelectEnum a = SelectEnum a
- unSelectEnum :: SelectEnum a -> a
- button :: (Widget Text, Validation Text)
- hidden :: (Widget Text, Validation Text)
- checkbox :: (Widget Bool, Validation Bool)
- file :: (Widget Text, Validation Text)
- text :: (Widget Text, Validation Text)
- textarea :: (Widget Text, Validation Text)
- password :: (Widget Text, Validation Text)
- search :: (Widget Text, Validation Text)
- email :: (Widget EmailAddress, Validation EmailAddress)
- uri :: (Widget URI, Validation URI)
- tel :: (Widget Text, Validation Text)
- number :: (Num a, Show a, Read a) => (Widget a, Validation a)
- integral :: (Integral a, Show a, Read a) => (Widget a, Validation a)
- boundedNumber :: (Bounded a, Num a, Show a, Read a) => (Widget a, Validation a)
- boundedIntegral :: (Bounded a, Integral a, Show a, Read a) => (Widget a, Validation a)
- date :: (FormatTime a, ParseTime a) => (Widget a, Validation a)
- time :: (FormatTime a, ParseTime a) => (Widget a, Validation a)
- datetime :: (FormatTime a, ParseTime a) => (Widget a, Validation a)
- datetime_local :: (FormatTime a, ParseTime a) => (Widget a, Validation a)
- type GroupedCollection' a = [(Text, [(a, (Text, Text))])]
- type Collection' a = [(a, (Text, Text))]
- select :: GroupedCollection' a -> (Widget Text, Validation a)
- multi_select :: GroupedCollection' a -> (Widget [Text], Validation [a])
- radio_buttons :: GroupedCollection' a -> (Widget Text, Validation a)
- buttons :: GroupedCollection' a -> (Widget Text, Validation a)
- checkboxes :: GroupedCollection' a -> (Widget [Text], Validation [a])
- selectEnum :: (Show a, Read a, Bounded a, Enum a) => Collection' a
- enum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> (Widget Text, Validation a)) -> (Widget a, Validation a)
- group_ :: Collection' a -> GroupedCollection' a
- multiEnum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> (Widget [Text], Validation [a])) -> (Widget [a], Validation [a])
- humanize :: Text -> Text
Documentation
type Widget a = Maybe a -> Maybe Text -> Text -> InputOptions -> InputSource
The type of a widget renderer
class DefaultWidget a whereSource
Infer a Widget based on type
Instances
| DefaultWidget Bool | |
| DefaultWidget Char | |
| DefaultWidget Double | |
| DefaultWidget Float | |
| DefaultWidget Int | |
| DefaultWidget Integer | |
| DefaultWidget Text | |
| DefaultWidget EmailAddress | |
| DefaultWidget LocalTime | |
| DefaultWidget ZonedTime | |
| DefaultWidget TimeOfDay | |
| DefaultWidget UTCTime | |
| DefaultWidget Day | |
| DefaultWidget URI | |
| DefaultWidget a => DefaultWidget [a] | |
| (Integral a, Show a) => DefaultWidget (Ratio a) | |
| DefaultWidget a => DefaultWidget (Maybe a) | |
| (Show a, Read a, Bounded a, Enum a) => DefaultWidget (SelectEnum a) | |
| (Show a, Read a) => DefaultWidget (ShowRead a) | |
| (DefaultWidget a, DefaultWidget b) => DefaultWidget (a, b) |
data Validation a Source
Either try to parse the submitted values, or have a list of allowed values
Constructors
| Check ([Text] -> Maybe a) | |
| Includes (GroupedCollection' a) |
Instances
class DefaultValidation a whereSource
Instances
Options
data InputOptions Source
The setup for rendering an input. Blank is mempty
Constructors
| InputOptions | |
Fields
| |
Instances
A block label, inline label, or implied value label
Constructors
| Label Text | |
| InlineLabel Text | |
| DefaultLabel |
Wrappers
unShowRead :: ShowRead a -> aSource
newtype SelectEnum a Source
Wrapper for select boxes on enumerable types
Constructors
| SelectEnum a |
Instances
| Bounded a => Bounded (SelectEnum a) | |
| Enum a => Enum (SelectEnum a) | |
| Eq a => Eq (SelectEnum a) | |
| Ord a => Ord (SelectEnum a) | |
| Read a => Read (SelectEnum a) | |
| (Show a, Read a) => Show (SelectEnum a) | |
| (Show a, Read a, Bounded a, Enum a) => DefaultWidget (SelectEnum a) | |
| (Show a, Read a, Bounded a, Enum a) => DefaultValidation (SelectEnum a) |
unSelectEnum :: SelectEnum a -> aSource
Widgets
button :: (Widget Text, Validation Text)Source
hidden :: (Widget Text, Validation Text)Source
file :: (Widget Text, Validation Text)Source
Text-like
text :: (Widget Text, Validation Text)Source
textarea :: (Widget Text, Validation Text)Source
password :: (Widget Text, Validation Text)Source
search :: (Widget Text, Validation Text)Source
uri :: (Widget URI, Validation URI)Source
tel :: (Widget Text, Validation Text)Source
Numbers
boundedNumber :: (Bounded a, Num a, Show a, Read a) => (Widget a, Validation a)Source
boundedIntegral :: (Bounded a, Integral a, Show a, Read a) => (Widget a, Validation a)Source
Dates and times
date :: (FormatTime a, ParseTime a) => (Widget a, Validation a)Source
time :: (FormatTime a, ParseTime a) => (Widget a, Validation a)Source
datetime :: (FormatTime a, ParseTime a) => (Widget a, Validation a)Source
datetime_local :: (FormatTime a, ParseTime a) => (Widget a, Validation a)Source
Collections
type GroupedCollection' a = [(Text, [(a, (Text, Text))])]Source
GroupedCollection including the parsed value
type Collection' a = [(a, (Text, Text))]Source
Collection including the parsed value
select :: GroupedCollection' a -> (Widget Text, Validation a)Source
multi_select :: GroupedCollection' a -> (Widget [Text], Validation [a])Source
radio_buttons :: GroupedCollection' a -> (Widget Text, Validation a)Source
buttons :: GroupedCollection' a -> (Widget Text, Validation a)Source
checkboxes :: GroupedCollection' a -> (Widget [Text], Validation [a])Source
Helpers
selectEnum :: (Show a, Read a, Bounded a, Enum a) => Collection' aSource
Derive a collection from an enumerable type
enum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> (Widget Text, Validation a)) -> (Widget a, Validation a)Source
Feed a collection Widget and Validation from an enumerable type
group_ :: Collection' a -> GroupedCollection' aSource
Push any Collection' to a trivial GroupedCollection'
multiEnum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> (Widget [Text], Validation [a])) -> (Widget [a], Validation [a])Source
Feed a multi-select collection Widget and Validation from an enumerable type