Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added fiRequired :: Bool to FieldInfo

  • Loading branch information...
commit 77eb435a629717f063f7a31190162344b0fc6a7f 1 parent 9158268
@softmechanics authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.