| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
SimpleForm.Digestive
Contents
Description
SimpleForm implementation that works along with digestive-functors
This module is for constructing forms that only output to Html. For forms that also parse input, see SimpleForm.Digestive.Combined
- data SimpleForm r a
- simpleForm :: ToMarkup v => Renderer -> (View v, Maybe a) -> SimpleForm a () -> Html
- simpleForm' :: ToMarkup v => Renderer -> (View v, Maybe a) -> SimpleForm a r -> (r, Html)
- input :: Text -> (r -> Maybe a) -> Widget a -> InputOptions -> SimpleForm r ()
- input_ :: DefaultWidget a => Text -> (r -> Maybe a) -> SimpleForm r ()
- choiceInput :: Text -> (r -> Maybe a) -> (GroupedCollection -> Widget a) -> InputOptions -> SimpleForm r ()
- choiceInput_ :: Text -> (r -> Maybe Text) -> SimpleForm r ()
- toForm :: ToMarkup h => h -> SimpleForm a ()
- withFields :: Maybe Text -> (r' -> r) -> SimpleForm r a -> SimpleForm r' a
- wrap :: (Html -> Html) -> SimpleForm r a -> SimpleForm r a
- fieldset :: Maybe Text -> (r' -> r) -> SimpleForm r a -> SimpleForm r' a
Documentation
data SimpleForm r a Source
A form for producing something of type r
Instances
| Monad (SimpleForm r) | |
| Functor (SimpleForm r) | |
| MonadFix (SimpleForm r) | |
| Applicative (SimpleForm r) | |
| Monoid a => Monoid (SimpleForm r a) |
Arguments
| :: ToMarkup v | |
| => Renderer | |
| -> (View v, Maybe a) | Results of running a digestive-functors |
| -> SimpleForm a () | The simple form to render |
| -> Html |
Render a SimpleForm to Html
This produces the contents of the form, but you must still wrap it in the actual <form> element.
Arguments
| :: ToMarkup v | |
| => Renderer | |
| -> (View v, Maybe a) | Results of running a digestive-functors |
| -> SimpleForm a r | The simple form to render |
| -> (r, Html) |
Render a SimpleForm to Html and get the return value
This produces the contents of the form, but you must still wrap it in the actual <form> element.
Create forms
Arguments
| :: Text | Form element name |
| -> (r -> Maybe a) | Get value from parsed data |
| -> Widget a | Widget to use (such as |
| -> InputOptions | Other options |
| -> SimpleForm r () |
Create an input element for a SimpleForm
input "username" (Just . username) wdef mempty
Arguments
| :: DefaultWidget a | |
| => Text | Form element name |
| -> (r -> Maybe a) | Get value from parsed data |
| -> SimpleForm r () |
Same as input, but just use the default options
Arguments
| :: Text | Form element name |
| -> (r -> Maybe a) | Get value from parsed data |
| -> (GroupedCollection -> Widget a) | Widget to use |
| -> InputOptions | Other options |
| -> SimpleForm r () |
Arguments
| :: Text | Form element name |
| -> (r -> Maybe Text) | Get value from parsed data |
| -> SimpleForm r () |
Like choiceInput, but chooses defaults for Widget and InputOptions
toForm :: ToMarkup h => h -> SimpleForm a () Source
Add some raw markup to a SimpleForm
Subforms
Arguments
| :: Maybe Text | Optional subview name |
| -> (r' -> r) | Projection function |
| -> SimpleForm r a | |
| -> SimpleForm r' a |
Project out some part of the parsed data
wrap :: (Html -> Html) -> SimpleForm r a -> SimpleForm r a Source
Wrap a SimpleForm in an Html tag
fieldset :: Maybe Text -> (r' -> r) -> SimpleForm r a -> SimpleForm r' a Source
Like withFields, but also wrap in fieldset tag