snap-extras-0.9: A collection of useful helpers and utilities for Snap web applications.

Safe HaskellNone

Snap.Extras.FormUtils

Contents

Synopsis

Transformers

maybeTrans :: (Eq a, IsString a) => a -> Result v (Maybe a)Source

Transform to Nothing if field is empty string

readMayTrans :: Read a => Text -> Result v (Maybe a)Source

Maybe read into target value

readTrans :: (Read a, IsString v) => Text -> Result v aSource

Read into target value

Compiled splices

editFormSpliceSource

Arguments

:: (Monad m, MonadSnap n) 
=> (n (Maybe a) -> HeistT n m b)

Function for generating a splice from an optional default value calculated at runtime.

-> (ByteString -> n (Maybe a))

Function for retrieving the form default by ID.

-> HeistT n m b 

Constructs a generalized edit form splice that looks up an ID param specified by the by attribute. You might use this splice as follows:

 <editFormSplice by="id">

If you don't specify the by attribute, the default is by="id".