yesod-0.5.1: Creation of type-safe, RESTful web applications.

Yesod.Form

Contents

Description

Parse forms (and query strings).

Synopsis

Data types

data GForm sub y xml a Source

A generic form, allowing you to specifying the subsite datatype, master site datatype, a datatype for the form XML and the return type.

Instances

Monoid xml => Functor (GForm sub url xml) 
Monoid xml => Applicative (GForm sub url xml) 

data FormResult a Source

A form can produce three different results: there was no data available, the data was invalid, or there was a successful parse.

The Applicative instance will concatenate the failure messages in two FormResults.

data Enctype Source

The encoding type required by a form. The Show instance produces values that can be inserted directly into HTML.

Constructors

UrlEncoded 
Multipart 

newtype Textarea Source

A newtype wrapper around a String that converts newlines to HTML br-tags.

Constructors

Textarea 

Fields

unTextarea :: String
 

Type synonyms

type Form sub y = GForm sub y (GWidget sub y ())Source

type Formlet sub y a = Maybe a -> Form sub y aSource

type FormField sub y = GForm sub y [FieldInfo sub y]Source

type FormletField sub y a = Maybe a -> FormField sub y aSource

type FormInput sub y = GForm sub y [GWidget sub y ()]Source

Unwrapping functions

runFormGet :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)Source

Run a form against GET parameters.

runFormPost :: GForm sub y xml a -> GHandler sub y (FormResult a, xml, Enctype)Source

Run a form against POST parameters.

runFormGet' :: GForm sub y xml a -> GHandler sub y aSource

Run a form against GET parameters, disregarding the resulting HTML and returning an error response on invalid input.

runFormPost' :: GForm sub y xml a -> GHandler sub y aSource

Run a form against POST parameters, disregarding the resulting HTML and returning an error response on invalid input.

Field/form helpers

fieldsToTable :: FormField sub y a -> Form sub y aSource

Display the label, tooltip, input code and errors in a single row of a table.

fieldsToPlain :: FormField sub y a -> Form sub y aSource

Display only the actual input widget code, without any decoration.

checkForm :: (a -> FormResult b) -> GForm s m x a -> GForm s m x bSource

Template Haskell

mkToForm :: [EntityDef] -> Q [Dec]Source

Create ToForm instances for the entities given. In addition to regular EntityDef attributes understood by persistent, it also understands label= and tooltip=.

Re-exports