flex-tasks-0.0.0
Safe HaskellNone
LanguageHaskell2010

FlexTask.FormUtil

Description

Functions for creating and composing forms.

Synopsis

Functions for Rendered

($$>) :: (Monad w, Monad m) => Rendered' m (w a) -> Rendered' m (w b) -> Rendered' m (w b) infixr 0 Source #

Compose two forms sequentially. The output form contains all of the fields from both input forms.

addCss Source #

Arguments

:: (render ~ RY FlexForm, Functor m) 
=> (render -> Css)

CSS template

-> Rendered' m Widget

Form to add to

-> Rendered' m Widget 

Add CSS to a form. Use with Yesod Cassius or Lucius Shakespeare quasi quoters or hosted files.

addJs Source #

Arguments

:: (render ~ RY FlexForm, Functor m) 
=> (render -> Javascript)

Javascript template

-> Rendered' m Widget

Form to add to

-> Rendered' m Widget 

Add JavaScript to a form. Use with Yesod Julius Shakespeare quasi quoters or hosted files.

addCssAndJs Source #

Arguments

:: (render ~ RY FlexForm, Functor m) 
=> (render -> Css)

CSS template

-> (render -> Javascript)

Javascript template

-> Rendered' m Widget

Form to add to

-> Rendered' m Widget 

Like addCss and addJs, but for including CSS and JavaScript in one step.

applyToWidget :: Functor m => (w -> w') -> Rendered' m w -> Rendered' m w' Source #

Apply some function to the embedded widget of a Rendered value.

getFormData :: Rendered Widget -> IO ([Text], HtmlDict) Source #

Extract a form from the environment. The result is an IO embedded tuple of field IDs and a map of language and internationalized html pairs.

Convenience functions for Yesod FieldSettings

addAttribute :: (Text, Text) -> FieldSettings app -> FieldSettings app Source #

Add an attribute-value pair to the given FieldSettings

addAttributes :: [(Text, Text)] -> FieldSettings app -> FieldSettings app Source #

Add a list of attribute-value pairs to the given FieldSettings

addCssClass :: Text -> FieldSettings app -> FieldSettings app Source #

Add a CSS class to the given FieldSettings

addNameAndCssClass :: Text -> Text -> FieldSettings app Source #

Convenience function to directly create a Yesod FieldSetting with this name and CSS Class.

readOnly :: FieldSettings app -> FieldSettings app Source #

Turn FieldSettings into a read-only input field

Convenience for internationalization

universalLabel :: String -> SomeMessage FlexForm Source #

Turn a String into a label for all languages.

showToUniversalLabel :: Show a => a -> SomeMessage FlexForm Source #

Turn the Show instance of a value into a label for all languages

functions for custom forms

newFlexId :: MForm Handler Text Source #

Get a unique identifier for an html element. The format is "flexident[number]"

newFlexName :: MForm Handler Text Source #

Get a unique name for an html element. The format is "flex[number]"

repeatFlexName :: MForm Handler Text Source #

repeat the last received name.