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

Yesod.Form.Core

Contents

Synopsis

Documentation

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.

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

Constructors

GForm 

Instances

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

newFormIdent :: Monad m => StateT Ints m StringSource

Get a unique identifier.

type Env = [(String, String)]Source

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 

data Ints Source

Constructors

IntCons Int Ints 
IntSingle Int 

Instances

requiredFieldHelper :: FieldProfile sub y a -> FormFieldSettings -> Maybe a -> FormField sub y aSource

Create a required field (ie, one that cannot be blank) from a FieldProfile.ngs

optionalFieldHelper :: FieldProfile sub y a -> FormFieldSettings -> FormletField sub y (Maybe a)Source

Create an optional field (ie, one that can be blank) from a FieldProfile.

fieldsToInput :: [FieldInfo sub y] -> [GWidget sub y ()]Source

mapFormXml :: (xml1 -> xml2) -> GForm s y xml1 a -> GForm s y xml2 aSource

Convert the XML in a GForm.

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

Data types

data FieldInfo sub y Source

Using this as the intermediate XML representation for fields allows us to write generic field functions and then different functions for producing actual HTML. See, for example, fieldsToTable and fieldsToPlain.

Constructors

FieldInfo 

data FieldProfile sub y a Source

A generic definition of a form field that can be used for generating both required and optional fields. See 'requiredFieldHelper and optionalFieldHelper.

Constructors

FieldProfile 

Fields

fpParse :: String -> Either String a
 
fpRender :: a -> String
 
fpWidget :: String -> String -> String -> Bool -> GWidget sub y ()

ID, name, value, required

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