summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-11-27 13:45:22 +0100
committerYorhel <git@yorhel.nl>2019-11-27 13:45:25 +0100
commit9c4835a94263127f780c0b96db89aa25ceefd960 (patch)
treecc0b6c4e584a4898aaa8c4f00ebb19c43a3d4adf /elm/Lib
parent7cb953265e54a731eb8a5c6bb0d4a45ea337fa80 (diff)
Elm: Use fieldset to disable the form while loading
I wasn't able to do this while the .maintabs used floats.
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Html.elm8
1 files changed, 8 insertions, 0 deletions
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm
index 6e67cefb..86c0f8f7 100644
--- a/elm/Lib/Html.elm
+++ b/elm/Lib/Html.elm
@@ -31,6 +31,14 @@ br_ : Int -> Html m
br_ n = if n == 1 then br [] [] else span [] <| List.repeat n <| br [] []
+-- Quick short-hand way of creating a form that can be disabled.
+-- Usage:
+-- form_ Submit_msg (state == Disabled) [contents]
+form_ : msg -> Bool -> List (Html msg) -> Html msg
+form_ sub dis cont = Html.form [ onSubmit sub ]
+ [ fieldset [disabled dis] cont ]
+
+
inputButton : String -> m -> List (Attribute m) -> Html m
inputButton val onch attrs =
input ([ type_ "button", class "submit", tabindex 10, value val, onClick onch] ++ attrs) []