From 9c4835a94263127f780c0b96db89aa25ceefd960 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Wed, 27 Nov 2019 13:45:22 +0100 Subject: Elm: Use fieldset to disable the form while loading I wasn't able to do this while the .maintabs used floats. --- elm/Lib/Html.elm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'elm/Lib/Html.elm') 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) [] -- cgit v1.2.3