simple-form-0.4: Forms that configure themselves based on type

Safe HaskellNone

SimpleForm.Combined

Contents

Description

Forms that configure themselves based on type

The Combined module both renders to Html and also parses input.

Synopsis

Documentation

type Widget a = Maybe a -> Maybe Text -> Text -> InputOptions -> InputSource

The type of a widget renderer

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

Options

data InputOptions Source

The setup for rendering an input. Blank is mempty

Constructors

InputOptions 

Fields

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 Source

A block label, inline label, or implied value label

Constructors

Label Text 
InlineLabel Text 
DefaultLabel 

Wrappers

newtype ShowRead a Source

Wrapper for types that should be rendered using show

Constructors

ShowRead a 

Instances

Eq a => Eq (ShowRead a) 
Ord a => Ord (ShowRead a) 
Read a => Read (ShowRead a) 
(Show a, Read a) => Show (ShowRead a) 
(Show a, Read a) => DefaultWidget (ShowRead a) 
Read a => DefaultValidation (ShowRead a) 

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) 

Widgets

file :: (Widget Text, Validation Text)Source

Text-like

text :: (Widget Text, Validation Text)Source

tel :: (Widget Text, Validation Text)Source

Numbers

number :: (Num a, Show a, Read a) => (Widget a, Validation a)Source

Dates and times

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

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

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

humanize :: Text -> TextSource

Format identifiers nicely for humans to read