Safe Haskell | None |
---|---|
Language | Haskell98 |
This module provides functions creating Reform using lucid markup.
This module assumes that you wish for text based controls such as inputText
and textarea
to using Text
values. If you prefer String
see Text.Reform.Blaze.String.
Synopsis
- inputText :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Text -> Form m input error (HtmlT f ()) () Text
- inputPassword :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Form m input error (HtmlT f ()) () Text
- inputSubmit :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Text -> Form m input error (HtmlT f ()) () (Maybe Text)
- inputReset :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Text -> Form m input error (HtmlT f ()) () ()
- inputHidden :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Text -> Form m input error (HtmlT f ()) () Text
- inputButton :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Text -> Form m input error (HtmlT f ()) () ()
- inputCheckbox :: forall x error input m f. (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Bool -> Form m input error (HtmlT f ()) () Bool
- inputCheckboxes :: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) => [(a, lbl)] -> (a -> Bool) -> Form m input error (HtmlT f ()) () [a]
- inputRadio :: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) => [(a, lbl)] -> (a -> Bool) -> Form m input error (HtmlT f ()) () a
- inputFile :: (Monad m, FormError error, FormInput input, ErrorInputType error ~ input, Applicative f) => Form m input error (HtmlT f ()) () (FileType input)
- textarea :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Monad f) => Int -> Int -> Text -> Form m input error (HtmlT f ()) () Text
- buttonSubmit :: (Monad m, FormError error, FormInput input, ErrorInputType error ~ input, ToHtml children, Monad f) => Text -> children -> Form m input error (HtmlT f ()) () (Maybe Text)
- buttonReset :: (Monad m, FormError error, ToHtml children, Monad f) => children -> Form m input error (HtmlT f ()) () ()
- button :: (Monad m, FormError error, ToHtml children, Monad f) => children -> Form m input error (HtmlT f ()) () ()
- select :: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) => [(a, lbl)] -> (a -> Bool) -> Form m input error (HtmlT f ()) () a
- selectMultiple :: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) => [(a, lbl)] -> (a -> Bool) -> Form m input error (HtmlT f ()) () [a]
- label :: (Monad m, Monad f) => HtmlT f () -> Form m input error (HtmlT f ()) () ()
- errorList :: (Monad m, ToHtml error, Monad f) => Form m input error (HtmlT f ()) () ()
- childErrorList :: (Monad m, ToHtml error, Monad f) => Form m input error (HtmlT f ()) () ()
- br :: (Monad m, Applicative f) => Form m input error (HtmlT f ()) () ()
- fieldset :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a
- ol :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a
- ul :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a
- li :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a
- formGenGET :: Applicative m => Text -> [(Text, Text)] -> HtmlT m b -> HtmlT m b
- formGenPOST :: Applicative m => Text -> [(Text, Text)] -> HtmlT m b -> HtmlT m b
<input> element
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Text | initial value |
-> Form m input error (HtmlT f ()) () Text |
Create an <input type="text">
element
inputPassword :: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) => Form m input error (HtmlT f ()) () Text Source #
Create an <input type="password">
element
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Text |
|
-> Form m input error (HtmlT f ()) () (Maybe Text) |
Create an <input type="submit">
element
returns:
Just
value- if this button was used to submit the form.
Nothing
- if this button was not used to submit the form.
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Text | value attribute. Used only to label the button. |
-> Form m input error (HtmlT f ()) () () |
Create an <input type="reset">
element
This element does not add any data to the form data set.
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Text | value to store in the hidden element |
-> Form m input error (HtmlT f ()) () Text |
Create an <input type="hidden">
element
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Text | value attribute. Used to label the button. |
-> Form m input error (HtmlT f ()) () () |
Create an <input type="button">
element
The element is a push button with a text label. The button does nothing by default, but actions can be added using javascript. This element does not add any data to the form data set.
see also: button
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Applicative f) | |
=> Bool | initially checked |
-> Form m input error (HtmlT f ()) () Bool |
Create a single <input type="checkbox">
element
returns a Bool
indicating if it was checked or not.
see also inputCheckboxes
FIXME: Should this built on something in Generalized?
:: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) | |
=> [(a, lbl)] | value, label, initially checked |
-> (a -> Bool) | function which indicates if a value should be checked initially |
-> Form m input error (HtmlT f ()) () [a] |
Create a group of <input type="checkbox">
elements
:: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) | |
=> [(a, lbl)] | value, label, initially checked |
-> (a -> Bool) | isDefault |
-> Form m input error (HtmlT f ()) () a |
Create a group of <input type="radio">
elements
inputFile :: (Monad m, FormError error, FormInput input, ErrorInputType error ~ input, Applicative f) => Form m input error (HtmlT f ()) () (FileType input) Source #
Create an <input type="file">
element
This control may succeed even if the user does not actually select a file to upload. In that case the uploaded name will likely be "" and the file contents will be empty as well.
<textarea> element
:: (Monad m, FormInput input, FormError error, ErrorInputType error ~ input, Monad f) | |
=> Int | cols |
-> Int | rows |
-> Text | initial contents |
-> Form m input error (HtmlT f ()) () Text |
Create a <textarea></textarea> element
<button> element
:: (Monad m, FormError error, FormInput input, ErrorInputType error ~ input, ToHtml children, Monad f) | |
=> Text | value attribute. Returned if this button submits the form. |
-> children | children to embed in the <button> |
-> Form m input error (HtmlT f ()) () (Maybe Text) |
create a <button type="submit"></button>
element
buttonReset :: (Monad m, FormError error, ToHtml children, Monad f) => children -> Form m input error (HtmlT f ()) () () Source #
create a <button type="reset"></button>
element
This element does not add any data to the form data set.
button :: (Monad m, FormError error, ToHtml children, Monad f) => children -> Form m input error (HtmlT f ()) () () Source #
create a <button type="button"></button>
element
This element does not add any data to the form data set.
<select> element
:: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) | |
=> [(a, lbl)] | value, label |
-> (a -> Bool) | isDefault, must match *exactly one* element in the list of choices |
-> Form m input error (HtmlT f ()) () a |
create <select></select>
element plus its <option></option>
children.
see also: selectMultiple
:: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input, ToHtml lbl, Monad f) | |
=> [(a, lbl)] | value, label, initially checked |
-> (a -> Bool) | isSelected initially |
-> Form m input error (HtmlT f ()) () [a] |
create <select multiple="multiple"></select>
element plus its <option></option>
children.
This creates a <select>
element which allows more than one item to be selected.
<label> element
label :: (Monad m, Monad f) => HtmlT f () -> Form m input error (HtmlT f ()) () () Source #
create a <label>
element.
Use this with or ++ to ensure that the for
attribute references the correct id
.
label "some input field: " ++> inputText ""
errors
childErrorList :: (Monad m, ToHtml error, Monad f) => Form m input error (HtmlT f ()) () () Source #
layout functions
fieldset :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a Source #
wrap a <fieldset class="reform">
around a Form
ol :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a Source #
wrap an <ol class="reform">
around a Form
ul :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a Source #
wrap a <ul class="reform">
around a Form
li :: (Monad m, Functor m, Applicative f) => Form m input error (HtmlT f ()) proof a -> Form m input error (HtmlT f ()) proof a Source #
wrap a <li class="reform">
around a Form
:: Applicative m | |
=> Text | action url |
-> [(Text, Text)] | hidden fields to add to form |
-> HtmlT m b | |
-> HtmlT m b |
create <form action=action method="GET" enctype="multipart/form-data">