Commit e8351c67 authored by Thorsten Wißmann's avatar Thorsten Wißmann 🐧
Browse files

Use onChange on select element

Use onChange as an event handler for select elements (comboboxes),
because onInput is only allowed for text boxes.
parent ef303b5f
......@@ -3,7 +3,7 @@ import Html as Html
import Html.App as Html
import Html.Lazy as Html
import Html.Attributes as HA
import Html.Events exposing (onClick,onInput)
import Html.Events exposing (onClick)
import Html.Events as HE
import RailTree as RT
import RailTree exposing (RailTree)
......@@ -230,6 +230,11 @@ updateRails : (RailPuzzle.Model -> RailPuzzle.Model) -> Model -> Model
updateRails updater m =
{ m | rails = updater m.rails }
onChange : (String -> msg) -> Html.Attribute msg
onChange tagger =
HE.on "change" (Json.map tagger HE.targetValue)
viewHeader : Bool -> Html Msg
viewHeader clickableHeader =
let
......@@ -279,7 +284,7 @@ viewNavigation model =
|> List.indexedMap (\i -> (++) (toString (1+i) ++ ". "))
|> List.indexedMap (\i str ->
Html.option (attrs i model.network_index) [Html.text str])
|> Html.select [onInput SwitchNet]
|> Html.select [onChange SwitchNet]
query_switcher =
model.queries
......@@ -287,7 +292,7 @@ viewNavigation model =
|> List.map (List.map toString << List.map ((+) 1))
|> List.map (String.concat << List.intersperse ", ")
|> List.indexedMap (\i str -> Html.option (attrs i model.query_index) [Html.text str])
|> Html.select [onInput SwitchQuery]
|> Html.select [onChange SwitchQuery]
resetCars : Msg
resetCars = ForRails <| RailPuzzle.cmd RPCmd.ResetCars
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment