Safe Haskell | None |
---|
- runJSONForm :: MonadHandler m => FormInput m a -> m a
- jsonField :: (Monad m, FromJSON a) => RenderMessage (HandlerSite m) FormMessage => Field m a
The example of use
data Offer = Offer { name :: Text , description Text , supplier :: SupplierId , category :: CategoryId , tags :: [TagId] , images :: [Image] , variants :: [Variant] , active :: Bool }
offer <- runJSONForm $ Offer <$> ireq textField "name" <*> ireq textField "description" <*> ireq jsonField "supplier" <*> ireq jsonField "category") <*> ireq jsonField "tags") <*> ireq jsonField "images" <*> (fmap nub $ ireq jsonField "variants") <*> ireq boolField "active"
Functions
runJSONForm :: MonadHandler m => FormInput m a -> m aSource
Run JSON form