From 1675b1bebb359dcfac7078a6b72c4b483aa22081 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Sun, 23 Jan 2022 20:02:16 -0800 Subject: [PATCH] Fix check for validation errors in Form API. --- src/Form.elm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Form.elm b/src/Form.elm index 50a7ab31..795fdd33 100644 --- a/src/Form.elm +++ b/src/Form.elm @@ -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