From 9af79e4d13cdf21b6818f710461d8293a553c969 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 5 Jul 2012 11:58:53 +0300 Subject: [PATCH] Recognize 'on' for booleans --- yesod-form/Yesod/Form/Fields.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index fcca7344..52520836 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -370,6 +370,7 @@ boolField = Field "" -> Right Nothing "none" -> Right Nothing "yes" -> Right $ Just True + "on" -> Right $ Just True "no" -> Right $ Just False t -> Left $ SomeMessage $ MsgInvalidBool t showVal = either (\_ -> False) @@ -393,6 +394,7 @@ checkBoxField = Field checkBoxParser [] = Right $ Just False checkBoxParser (x:_) = case x of "yes" -> Right $ Just True + "on" -> Right $ Just True _ -> Right $ Just False showVal = either (\_ -> False)