mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 23:12:22 +03:00
Rename function.
This commit is contained in:
parent
b50f188499
commit
eae27223a3
@ -565,7 +565,7 @@ update _ _ _ msg model =
|
|||||||
GotFormResponse result ->
|
GotFormResponse result ->
|
||||||
case result of
|
case result of
|
||||||
Ok updatedFormModel ->
|
Ok updatedFormModel ->
|
||||||
if Form.hasErrors2 model.form then
|
if Form.hasErrors model.form then
|
||||||
( model, Effect.none )
|
( model, Effect.none )
|
||||||
|> withFlash (Err "Failed to submit or had errors")
|
|> withFlash (Err "Failed to submit or had errors")
|
||||||
|
|
||||||
|
24
src/Form.elm
24
src/Form.elm
@ -14,7 +14,7 @@ module Form exposing
|
|||||||
, withServerValidation
|
, withServerValidation
|
||||||
, withMax, withMin
|
, withMax, withMin
|
||||||
, withStep
|
, withStep
|
||||||
, hasErrors2, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
, hasErrors, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
||||||
, FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
, FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
||||||
, fieldStatusToString
|
, fieldStatusToString
|
||||||
)
|
)
|
||||||
@ -116,7 +116,7 @@ Steps
|
|||||||
|
|
||||||
## Internals?
|
## Internals?
|
||||||
|
|
||||||
@docs hasErrors2, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
@docs hasErrors, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
||||||
|
|
||||||
@docs FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
@docs FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ update submitEffect noEffect toMsg onResponse ((Form _ _ _ modelToValue) as form
|
|||||||
)
|
)
|
||||||
|
|
||||||
SubmitForm values ->
|
SubmitForm values ->
|
||||||
if hasErrors2 model then
|
if hasErrors model then
|
||||||
( { model | isSubmitting = Submitted }
|
( { model | isSubmitting = Submitted }
|
||||||
, noEffect
|
, noEffect
|
||||||
)
|
)
|
||||||
@ -1908,9 +1908,9 @@ renderedFields :
|
|||||||
-> List view
|
-> List view
|
||||||
renderedFields onFormMsg serverValidationErrors fields =
|
renderedFields onFormMsg serverValidationErrors fields =
|
||||||
let
|
let
|
||||||
hasErrors_ : Bool
|
hasErrors__ : Bool
|
||||||
hasErrors_ =
|
hasErrors__ =
|
||||||
hasErrors2 serverValidationErrors
|
hasErrors serverValidationErrors
|
||||||
in
|
in
|
||||||
fields
|
fields
|
||||||
|> List.reverse
|
|> List.reverse
|
||||||
@ -1940,7 +1940,7 @@ renderedFields onFormMsg serverValidationErrors fields =
|
|||||||
in
|
in
|
||||||
field.toHtml onFormMsg
|
field.toHtml onFormMsg
|
||||||
{ submitStatus = serverValidationErrors.isSubmitting }
|
{ submitStatus = serverValidationErrors.isSubmitting }
|
||||||
hasErrors_
|
hasErrors__
|
||||||
(simplify3 field)
|
(simplify3 field)
|
||||||
(Just thing)
|
(Just thing)
|
||||||
)
|
)
|
||||||
@ -1976,7 +1976,7 @@ apiHandler (Form _ decoder serverValidations _) =
|
|||||||
errors
|
errors
|
||||||
|> DataSource.map
|
|> DataSource.map
|
||||||
(\validationErrors ->
|
(\validationErrors ->
|
||||||
if hasErrors validationErrors then
|
if hasErrors_ validationErrors then
|
||||||
Server.Response.json
|
Server.Response.json
|
||||||
(validationErrors |> encodeErrors)
|
(validationErrors |> encodeErrors)
|
||||||
|
|
||||||
@ -2119,8 +2119,8 @@ submitHandlers myForm toDataSource =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
hasErrors : List ( String, RawFieldState error ) -> Bool
|
hasErrors_ : List ( String, RawFieldState error ) -> Bool
|
||||||
hasErrors validationErrors =
|
hasErrors_ validationErrors =
|
||||||
List.any
|
List.any
|
||||||
(\( _, entry ) ->
|
(\( _, entry ) ->
|
||||||
entry.errors |> List.isEmpty |> not
|
entry.errors |> List.isEmpty |> not
|
||||||
@ -2129,8 +2129,8 @@ hasErrors validationErrors =
|
|||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
hasErrors2 : Model -> Bool
|
hasErrors : Model -> Bool
|
||||||
hasErrors2 model =
|
hasErrors model =
|
||||||
Dict.Extra.any
|
Dict.Extra.any
|
||||||
(\_ entry ->
|
(\_ entry ->
|
||||||
entry.errors |> List.isEmpty |> not
|
entry.errors |> List.isEmpty |> not
|
||||||
|
Loading…
Reference in New Issue
Block a user