Created
November 13, 2016 19:00
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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