Skip to content

Instantly share code, notes, and snippets.

@ravicious
Created November 13, 2016 19:00
Show Gist options
  • Save ravicious/9c3535b1684eba441dbe94d2a9afe034 to your computer and use it in GitHub Desktop.
Save ravicious/9c3535b1684eba441dbe94d2a9afe034 to your computer and use it in GitHub Desktop.
A SSCCE for an issue with elm-lang/html. You can paste it to http://elm-lang.org/try.
import Html exposing (..)
import Html.Attributes exposing (..)
import Json.Encode
valueAttributes =
[ value ""
, property "value" (Json.Encode.string "")
, attribute "value" ""
]
selectOptions =
List.map
(\x -> option [ value <| toString <| fst x ] [ text <| snd x ])
[ ( 1, "Foo" ), ( 2, "Bar" ), ( 3, "Baz" ) ]
requiredSelect valueAttribute =
select
[ required True ]
<|
(option [ valueAttribute ] [ text "Please choose an option" ])
:: selectOptions
main =
Html.form []
[ div [] <| List.map requiredSelect valueAttributes
, button [ type' "submit" ] [ text "Submit" ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment