Update docs and remove obsolete globalErrors helper.

This commit is contained in:
Dillon Kearns 2022-08-01 10:40:24 +02:00
parent d7a2127daf
commit 985e79922c
5 changed files with 16 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -143,7 +143,7 @@ errorsForField formState field =
globalErrors : Form.Context String data -> Html msg
globalErrors formState =
formState.errors
|> Form.globalErrors
|> Form.errorsForField Validation.global
|> List.map (\error -> Html.li [] [ Html.text error ])
|> Html.ul [ Attr.style "color" "red" ]

View File

@ -1,5 +1,6 @@
module Form exposing
( Form, HtmlForm, StyledHtmlForm
( Form, HtmlForm, StyledHtmlForm, DoneForm
, Response(..)
, init
, field, hiddenField, hiddenKind
, Context
@ -10,11 +11,7 @@ module Form exposing
, dynamic
, runOneOfServerSideWithServerValidations
, AppContext
, DoneForm
, Response(..)
, globalErrors
-- subGroup
-- subGroup
)
{-| One of the core features of elm-pages is helping you manage form data end-to-end, including
@ -214,7 +211,9 @@ Totally customizable. Uses [`Form.FieldView`](Form-FieldView) to render all of t
## Building a Form Parser
@docs Form, HtmlForm, StyledHtmlForm
@docs Form, HtmlForm, StyledHtmlForm, DoneForm
@docs Response
@docs init
@ -759,12 +758,6 @@ errorsForField field_ (Errors errorsDict) =
|> Maybe.withDefault []
{-| -}
globalErrors : Errors error -> List error
globalErrors errors =
errors |> errorsForField Validation.global
{-| -}
type alias AppContext app =
{ app
@ -1254,6 +1247,7 @@ renderStyledHtml attrs maybe app data (FinalForm options a b c) =
Html.Styled.Lazy.lazy6 renderStyledHelper attrs maybe options app data (FormInternal a b c)
{-| -}
type Response error
= Response
{ fields : List ( String, String )

View File

@ -25,6 +25,11 @@ module Form.Validation exposing
@docs map3, map4, map5, map6, map7, map8, map9
## Global Validation
@docs global
-}
import Dict exposing (Dict)

View File

@ -1,7 +1,7 @@
module Server.Request exposing
( Parser
, succeed, fromResult, skip
, formData, formDataWithoutServerValidation
, formData, formDataWithoutServerValidation, formDataWithServerValidation
, rawFormData
, method, rawBody, allCookies, rawHeaders, queryParams
, requestTime, optionalHeader, expectContentType, expectJsonBody
@ -15,7 +15,6 @@ module Server.Request exposing
, map3, map4, map5, map6, map7, map8, map9
, Method(..), methodToString
, errorsToString, errorToString, getDecoder, ValidationError
, formDataWithServerValidation
)
{-|
@ -27,7 +26,7 @@ module Server.Request exposing
## Forms
@docs formData, formDataWithoutServerValidation
@docs formData, formDataWithoutServerValidation, formDataWithServerValidation
@docs rawFormData