mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-01 07:45:22 +03:00
Include client validations in server response.
This commit is contained in:
parent
3522ed2b66
commit
2e4f87767f
12
src/Form.elm
12
src/Form.elm
@ -724,8 +724,18 @@ with (Field field) (Form fields decoder serverValidations modelToValue) =
|
||||
(field.serverValidation arg2
|
||||
|> DataSource.map
|
||||
(\validationErrors ->
|
||||
let
|
||||
clientErrors : List String
|
||||
clientErrors =
|
||||
case field.decode arg2 of
|
||||
Ok _ ->
|
||||
[]
|
||||
|
||||
Err error ->
|
||||
[ error ]
|
||||
in
|
||||
( field.name
|
||||
, { errors = validationErrors
|
||||
, { errors = validationErrors ++ clientErrors
|
||||
, raw = arg2
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user