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
eae27223a3
commit
5ca486c69c
@ -245,7 +245,7 @@ form user =
|
|||||||
else
|
else
|
||||||
DataSource.succeed []
|
DataSource.succeed []
|
||||||
)
|
)
|
||||||
|> Form.withClientValidation2
|
|> Form.withRecoverableClientValidation
|
||||||
(\username ->
|
(\username ->
|
||||||
Ok
|
Ok
|
||||||
( username
|
( username
|
||||||
@ -256,7 +256,7 @@ form user =
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> Form.withClientValidation2
|
|> Form.withRecoverableClientValidation
|
||||||
(\username ->
|
(\username ->
|
||||||
Ok
|
Ok
|
||||||
( username
|
( username
|
||||||
@ -267,7 +267,7 @@ form user =
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> Form.withClientValidation2
|
|> Form.withRecoverableClientValidation
|
||||||
(\username ->
|
(\username ->
|
||||||
Ok
|
Ok
|
||||||
( username
|
( username
|
||||||
@ -422,7 +422,7 @@ form user =
|
|||||||
"acceptTerms"
|
"acceptTerms"
|
||||||
False
|
False
|
||||||
(checkboxInput { name = "Accept terms", description = "Please read the terms before proceeding." })
|
(checkboxInput { name = "Accept terms", description = "Please read the terms before proceeding." })
|
||||||
|> Form.withClientValidation2
|
|> Form.withRecoverableClientValidation
|
||||||
(\checked ->
|
(\checked ->
|
||||||
if checked then
|
if checked then
|
||||||
Ok ( (), [] )
|
Ok ( (), [] )
|
||||||
|
10
src/Form.elm
10
src/Form.elm
@ -14,7 +14,7 @@ module Form exposing
|
|||||||
, withServerValidation
|
, withServerValidation
|
||||||
, withMax, withMin
|
, withMax, withMin
|
||||||
, withStep
|
, withStep
|
||||||
, hasErrors, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
, hasErrors, rawValues, runClientValidations, withClientValidation, withRecoverableClientValidation
|
||||||
, FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
, FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
||||||
, fieldStatusToString
|
, fieldStatusToString
|
||||||
)
|
)
|
||||||
@ -81,7 +81,7 @@ The form submissions are handled internally. Both tracking the submit status, an
|
|||||||
|
|
||||||
Whenever possible, it's best to use the platform. For example, if you mark a field as number, the UI will give you number inputs. If you use an email input field, a mobile phone can display a special email input keyboard, or a desktop browser can suggest autofill input based on that.
|
Whenever possible, it's best to use the platform. For example, if you mark a field as number, the UI will give you number inputs. If you use an email input field, a mobile phone can display a special email input keyboard, or a desktop browser can suggest autofill input based on that.
|
||||||
|
|
||||||
A Date type can be entered with the native date picker UI of the user's browser, which can be mobile-friendly by using the native mobile browser's built-in UI. But this also implies a validation, and can't be parsed into an Elm type. So you get two for the price of one. A UI, and a valdation. The validations are run on both client and server, so you can trust them without having to maintain duplicate logic for the server-side.
|
A Date type can be entered with the native date picker UI of the user's browser, which can be mobile-friendly by using the native mobile browser's built-in UI. But this also implies a validation, and can't be parsed into an Elm type. So you get two for the price of one. A UI, and a validation. The validations are run on both client and server, so you can trust them without having to maintain duplicate logic for the server-side.
|
||||||
|
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
@ -116,7 +116,7 @@ Steps
|
|||||||
|
|
||||||
## Internals?
|
## Internals?
|
||||||
|
|
||||||
@docs hasErrors, rawValues, runClientValidations, withClientValidation, withClientValidation2
|
@docs hasErrors, rawValues, runClientValidations, withClientValidation, withRecoverableClientValidation
|
||||||
|
|
||||||
@docs FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
@docs FieldInfoSimple, FieldState, FinalFieldInfo, FormInfo, No, RawFieldState, TimeOfDay, Yes
|
||||||
|
|
||||||
@ -1494,8 +1494,8 @@ withClientValidation mapFn (Field field) =
|
|||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
withClientValidation2 : (value -> Result (List error) ( mapped, List error )) -> Field msg error value view constraints -> Field msg error mapped view { constraints | wasMapped : Yes }
|
withRecoverableClientValidation : (value -> Result (List error) ( mapped, List error )) -> Field msg error value view constraints -> Field msg error mapped view { constraints | wasMapped : Yes }
|
||||||
withClientValidation2 mapFn (Field field) =
|
withRecoverableClientValidation mapFn (Field field) =
|
||||||
Field
|
Field
|
||||||
{ name = field.name
|
{ name = field.name
|
||||||
, initialValue = field.initialValue
|
, initialValue = field.initialValue
|
||||||
|
Loading…
Reference in New Issue
Block a user