summaryrefslogtreecommitdiff
path: root/elm/Lib/Html.elm
diff options
context:
space:
mode:
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 ])