Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added fiRequired :: Bool to FieldInfo

  • Loading branch information...
commit 77eb435a629717f063f7a31190162344b0fc6a7f 1 parent 9158268
softmechanics authored
3  Yesod/Form/Core.hs
@@ -160,6 +160,7 @@ requiredFieldHelper (FieldProfile parse render mkWidget) ffs orig = GForm $ do
160 160
             , fiErrors = case res of
161 161
                             FormFailure [x] -> Just $ string x
162 162
                             _ -> Nothing
  163
+            , fiRequired = True
163 164
             }
164 165
     return (res, [fi], UrlEncoded)
165 166
 
@@ -191,6 +192,7 @@ optionalFieldHelper (FieldProfile parse render mkWidget) ffs orig' = GForm $ do
191 192
             , fiErrors = case res of
192 193
                             FormFailure x -> Just $ string $ unlines x
193 194
                             _ -> Nothing
  195
+            , fiRequired = False
194 196
             }
195 197
     return (res, [fi], UrlEncoded)
196 198
 
@@ -212,6 +214,7 @@ data FieldInfo sub y = FieldInfo
212 214
     , fiIdent :: String
213 215
     , fiInput :: GWidget sub y ()
214 216
     , fiErrors :: Maybe Html
  217
+    , fiRequired :: Bool
215 218
     }
216 219
 
217 220
 data FormFieldSettings = FormFieldSettings
3  Yesod/Form/Fields.hs
@@ -114,6 +114,7 @@ boolField ffs orig = GForm $ do
114 114
             , fiErrors = case res of
115 115
                             FormFailure [x] -> Just $ string x
116 116
                             _ -> Nothing
  117
+            , fiRequired = True
117 118
             }
118 119
     return (res, [fi], UrlEncoded)
119 120
 
@@ -161,6 +162,7 @@ selectField pairs ffs initial = GForm $ do
161 162
             , fiErrors = case res of
162 163
                             FormFailure [x] -> Just $ string x
163 164
                             _ -> Nothing
  165
+            , fiRequired = True
164 166
             }
165 167
     return (res, [fi], UrlEncoded)
166 168
 
@@ -203,6 +205,7 @@ maybeSelectField pairs ffs initial' = GForm $ do
203 205
             , fiErrors = case res of
204 206
                             FormFailure [x] -> Just $ string x
205 207
                             _ -> Nothing
  208
+            , fiRequired = False
206 209
             }
207 210
     return (res, [fi], UrlEncoded)
208 211
 

0 notes on commit 77eb435

Please sign in to comment.
Something went wrong with that request. Please try again.