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

Safe HaskellNone

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

Synopsis

Documentation

data SimpleForm r a Source

A form for producing something of type r

simpleFormSource

Arguments

:: ToMarkup v 
=> Renderer 
-> (View v, Maybe a)

Results of running a digestive-functors Form

-> 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.

simpleForm'Source

Arguments

:: ToMarkup v 
=> Renderer 
-> (View v, Maybe a)

Results of running a digestive-functors Form

-> 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

inputSource

Arguments

:: Text

Form element name

-> (r -> Maybe a)

Get value from parsed data

-> Widget a

Widget to use (such as wdef)

-> InputOptions

Other options

-> SimpleForm r () 

Create an input element for a SimpleForm

 input "username" (Just . username) wdef mempty

input_Source

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

choiceInputSource

Arguments

:: Text

Form element name

-> (r -> Maybe a)

Get value from parsed data

-> (GroupedCollection -> Widget a)

Widget to use

-> InputOptions

Other options

-> SimpleForm r () 

Like input, but grabs a collection out of the View

choiceInput_Source

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

withFieldsSource

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 aSource

Wrap a SimpleForm in an Html tag

fieldset :: Maybe Text -> (r' -> r) -> SimpleForm r a -> SimpleForm r' aSource

Like withFields, but also wrap in fieldset tag