Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module providing a means of creating multiple input forms without the need to submit the form to generate a new input field unlike in MassInput.
Synopsis
- data MultiSettings site = MultiSettings {
- msAddClass :: !Text
- msDelClass :: !Text
- msTooltipClass :: Text
- msWrapperErrClass :: !Text
- msAddInner :: !(Maybe Html)
- msDelInner :: !(Maybe Html)
- msErrWidget :: Maybe (Html -> WidgetFor site ())
- data MultiView site = MultiView {}
- mmulti :: (site ~ HandlerSite m, MonadHandler m, RenderMessage site FormMessage) => Field m a -> FieldSettings site -> [a] -> Int -> MultiSettings site -> MForm m (FormResult [a], MultiView site)
- amulti :: (site ~ HandlerSite m, MonadHandler m, RenderMessage site FormMessage) => Field m a -> FieldSettings site -> [a] -> Int -> MultiSettings site -> AForm m [a]
- bs3Settings :: MultiSettings site
- bs3FASettings :: MultiSettings site
- bs4Settings :: MultiSettings site
- bs4FASettings :: MultiSettings site
Documentation
data MultiSettings site Source #
By default delete buttons have a margin-left
property of 0.75rem
.
You can override this by specifying an alternative value in a class
which is then passed inside MultiSettings
.
Since: 1.7.0
MultiSettings | |
|
The general structure of each individually generated field is as follows. There is an external wrapper element containing both an inner wrapper and any error messages that apply to that specific field. The inner wrapper contains both the field and it's corresponding delete button.
The structure is illustrated by the following:
<div .#{wrapperClass}> <div .#{wrapperClass}-inner> ^{fieldWidget} ^{deleteButton} ^{maybeErrorMessages}
Each wrapper element has the same class which is automatically generated. This class
is returned in the MultiView
should you wish to change the styling. The inner wrapper
uses the same class followed by -inner
. By default the wrapper and inner wrapper has
classes are as follows:
.#{wrapperClass} { margin-bottom: 1rem; } .#{wrapperClass}-inner { display: flex; flex-direction: row; }
Since: 1.7.0
mmulti :: (site ~ HandlerSite m, MonadHandler m, RenderMessage site FormMessage) => Field m a -> FieldSettings site -> [a] -> Int -> MultiSettings site -> MForm m (FormResult [a], MultiView site) Source #
Converts a form field into a monadic form containing an arbitrary number of the given fields as specified by the user. Returns a list of results, failing if the length of the list is less than the minimum requested values.
Since: 1.6.0
amulti :: (site ~ HandlerSite m, MonadHandler m, RenderMessage site FormMessage) => Field m a -> FieldSettings site -> [a] -> Int -> MultiSettings site -> AForm m [a] Source #
Applicative equivalent of mmulti
.
Note about tooltips: Rather than displaying the tooltip alongside each field the tooltip is displayed once at the top of the multi-field set.
Since: 1.6.0
bs3Settings :: MultiSettings site Source #
MultiSettings
for Bootstrap 3.
Since: 1.6.0
bs3FASettings :: MultiSettings site Source #
MultiSettings
for Bootstrap 3 with Font Awesome 5 Icons.
Uses fa-plus
for the add button and fa-trash-alt
for the delete button.
Since: 1.7.0
bs4Settings :: MultiSettings site Source #
MultiSettings
for Bootstrap 4.
Since: 1.6.0
bs4FASettings :: MultiSettings site Source #
MultiSettings
for Bootstrap 4 with Font Awesome 5 Icons.
Uses fa-plus
for the add button and fa-trash-alt
for the delete button.
Since: 1.7.0