mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-01 07:45:22 +03:00
Show required error message for missing required number field.
This commit is contained in:
parent
b82aa41416
commit
b7d58471f9
@ -640,8 +640,13 @@ requiredNumber name toHtmlFn =
|
||||
toHtmlFn (toInputRecord name Nothing info fieldInfo)
|
||||
, decode =
|
||||
\rawString ->
|
||||
rawString
|
||||
|> Maybe.andThen String.toInt
|
||||
case rawString of
|
||||
Nothing ->
|
||||
Err "This field is required"
|
||||
|
||||
Just string ->
|
||||
string
|
||||
|> String.toInt
|
||||
-- TODO should this be a custom type instead of String error? That way users can customize the error messages
|
||||
|> Result.fromMaybe "Not a valid number"
|
||||
, properties = []
|
||||
|
Loading…
Reference in New Issue
Block a user