From 4b2b14e3acbfc79f1c8c67b2b9e7d5a48a59552a Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 21 Jul 2010 09:41:25 +0300 Subject: [PATCH] Added intInput --- Yesod/Form.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Yesod/Form.hs b/Yesod/Form.hs index d6f08e4e..625548cc 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -72,6 +72,7 @@ module Yesod.Form -- * Pre-built inputs , stringInput , maybeStringInput + , intInput , boolInput , dayInput , maybeDayInput @@ -308,6 +309,13 @@ instance ToFormField String where instance ToFormField (Maybe String) where toFormField = maybeStringField +intInput :: Integral i => String -> FormInput sub master i +intInput n = + mapFormXml fieldsToInput $ + requiredFieldHelper intFieldProfile + { fpName = Just n + } Nothing + intField :: Integral i => Html () -> Html () -> FormletField sub y i intField l t = requiredFieldHelper intFieldProfile { fpLabel = l