Do not lose selected value in selectFieldHelper when validation fails
This commit is contained in:
parent
db1ff95520
commit
073c9fabd4
@ -1,5 +1,10 @@
|
||||
# ChangeLog for yesod-form
|
||||
|
||||
## Unreleased
|
||||
|
||||
* make sure a select field does not lose the selected value even if a validation on the
|
||||
field fails
|
||||
|
||||
## 1.6.2
|
||||
|
||||
* Move `addClass` from private/undocumented in `Yesod.Form.Bootstrap3` to `Yesod.Form.Functions` [#1510](https://github.com/yesodweb/yesod/pull/1510)
|
||||
|
||||
@ -759,7 +759,7 @@ selectFieldHelper outside onOpt inside opts' = Field
|
||||
, fieldEnctype = UrlEncoded
|
||||
}
|
||||
where
|
||||
render _ (Left _) = ""
|
||||
render _ (Left x) = x
|
||||
render opts (Right a) = maybe "" optionExternalValue $ listToMaybe $ filter ((== a) . optionInternalValue) opts
|
||||
selectParser _ [] = Right Nothing
|
||||
selectParser opts (s:_) = case s of
|
||||
|
||||
Loading…
Reference in New Issue
Block a user