Permalink
Browse files

added fiRequired :: Bool to FieldInfo

  • Loading branch information...
1 parent 9158268 commit 77eb435a629717f063f7a31190162344b0fc6a7f @softmechanics committed Oct 14, 2010
Showing with 6 additions and 0 deletions.
  1. +3 −0 Yesod/Form/Core.hs
  2. +3 −0 Yesod/Form/Fields.hs
View
3 Yesod/Form/Core.hs
@@ -160,6 +160,7 @@ requiredFieldHelper (FieldProfile parse render mkWidget) ffs orig = GForm $ do
, fiErrors = case res of
FormFailure [x] -> Just $ string x
_ -> Nothing
+ , fiRequired = True
}
return (res, [fi], UrlEncoded)
@@ -191,6 +192,7 @@ optionalFieldHelper (FieldProfile parse render mkWidget) ffs orig' = GForm $ do
, fiErrors = case res of
FormFailure x -> Just $ string $ unlines x
_ -> Nothing
+ , fiRequired = False
}
return (res, [fi], UrlEncoded)
@@ -212,6 +214,7 @@ data FieldInfo sub y = FieldInfo
, fiIdent :: String
, fiInput :: GWidget sub y ()
, fiErrors :: Maybe Html
+ , fiRequired :: Bool
}
data FormFieldSettings = FormFieldSettings
View
3 Yesod/Form/Fields.hs
@@ -114,6 +114,7 @@ boolField ffs orig = GForm $ do
, fiErrors = case res of
FormFailure [x] -> Just $ string x
_ -> Nothing
+ , fiRequired = True
}
return (res, [fi], UrlEncoded)
@@ -161,6 +162,7 @@ selectField pairs ffs initial = GForm $ do
, fiErrors = case res of
FormFailure [x] -> Just $ string x
_ -> Nothing
+ , fiRequired = True
}
return (res, [fi], UrlEncoded)
@@ -203,6 +205,7 @@ maybeSelectField pairs ffs initial' = GForm $ do
, fiErrors = case res of
FormFailure [x] -> Just $ string x
_ -> Nothing
+ , fiRequired = False
}
return (res, [fi], UrlEncoded)

0 comments on commit 77eb435

Please sign in to comment.