From 13d14259b08ab9d40f14bfc3edabb816e3ea8d20 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 12 May 2020 10:25:02 +0200 Subject: Char::Edit: Initial rewrite of the character edit form, general info first --- elm/Lib/Html.elm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'elm/Lib/Html.elm') 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 ]) -- cgit v1.2.3