Merge pull request #1544 from nmk/master
Do not lose selected value in `selectFieldHelper` when validation fails
This commit is contained in:
commit
6f76b5ff91
@ -1,5 +1,10 @@
|
|||||||
# ChangeLog for yesod-form
|
# 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
|
## 1.6.2
|
||||||
|
|
||||||
* Move `addClass` from private/undocumented in `Yesod.Form.Bootstrap3` to `Yesod.Form.Functions` [#1510](https://github.com/yesodweb/yesod/pull/1510)
|
* 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
|
, fieldEnctype = UrlEncoded
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
render _ (Left _) = ""
|
render _ (Left x) = x
|
||||||
render opts (Right a) = maybe "" optionExternalValue $ listToMaybe $ filter ((== a) . optionInternalValue) opts
|
render opts (Right a) = maybe "" optionExternalValue $ listToMaybe $ filter ((== a) . optionInternalValue) opts
|
||||||
selectParser _ [] = Right Nothing
|
selectParser _ [] = Right Nothing
|
||||||
selectParser opts (s:_) = case s of
|
selectParser opts (s:_) = case s of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user