summaryrefslogtreecommitdiff
path: root/elm/Lib/Html.elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-05-12 10:25:02 +0200
committerYorhel <git@yorhel.nl>2020-05-12 10:25:02 +0200
commit13d14259b08ab9d40f14bfc3edabb816e3ea8d20 (patch)
tree973e82be525997b212bd2f495af0731b57cd3c2d /elm/Lib/Html.elm
parentc18d0d12829c4c42910d66a4d7fbb035ba8dc7ac (diff)
Char::Edit: Initial rewrite of the character edit form, general info first
Diffstat (limited to 'elm/Lib/Html.elm')
-rw-r--r--elm/Lib/Html.elm6
1 files changed, 3 insertions, 3 deletions
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm
index 2e534246..2d7d516c 100644
--- a/elm/Lib/Html.elm
+++ b/elm/Lib/Html.elm
@@ -79,14 +79,14 @@ inputSelect nam sel onch attrs lst =
) <| List.indexedMap opt lst
-inputNumber : String -> Int -> (Int -> m) -> List (Attribute m) -> Html m
+inputNumber : String -> Maybe Int -> (Maybe Int -> m) -> List (Attribute m) -> Html m
inputNumber nam val onch attrs = input (
[ type_ "number"
, class "text"
, tabindex 10
, style "width" "40px"
- , value <| String.fromInt val
- , onInput (\s -> onch <| Maybe.withDefault 0 <| String.toInt s)
+ , value <| Maybe.withDefault "" <| Maybe.map String.fromInt val
+ , onInput (\s -> onch <| String.toInt s)
]
++ attrs
++ (if nam == "" then [] else [ id nam, name nam ])