Fix check for validation errors in Form API.

This commit is contained in:
Dillon Kearns 2022-01-23 20:02:16 -08:00
parent 78cc936272
commit 1675b1bebb

View File

@ -1917,8 +1917,13 @@ toRequest2 ((Form fields decoder serverValidations modelToValue) as form) =
(\model ->
case decoded of
Ok ( value, otherValidationErrors ) ->
--if not (hasErrors validationErrors) && (otherValidationErrors |> List.isEmpty) then
if otherValidationErrors |> List.isEmpty then
if
otherValidationErrors
|> List.any
(\( a, entryErrors ) ->
entryErrors |> List.isEmpty
)
then
Ok ( model, value )
else
@ -1998,7 +2003,8 @@ submitHandlers myForm toDataSource =
|> toDataSource model
Err model ->
Err () |> toDataSource model
Err ()
|> toDataSource model
)
-- TODO allow customizing headers or status code, or not?
|> DataSource.map Server.Response.render