selectp
and selectpm
allow a user to push ADTs in and
get ADTs out of a <select>
selectp : Monocle.Prism.Prism String a -> (Result String a -> msg) -> a -> List (Html.Attribute msg) -> List ( String, a ) -> Html msg
selectp
is wrapping up the idea of select box from a generic
comparable. However, Elm does everything through strings -- which is
why we’re using the Prism
. That Prism
onus is on you. The args are:
String
to our thing a
Result String a
, where a
is
our thing--to a msg for the onChangeHtml.Attributes
for the <select>
so you can have
custom classes, etc.( String, a )
where the String
is the label
for the option and the a
is our thing.selectpm : Monocle.Prism.Prism String a -> (List (Result String a) -> msg) -> List a -> List (Html.Attribute msg) -> List ( String, a ) -> Html msg
Like selectp
, but a <select multiple>
which takes a list of
selected values and the Msg needs to be a list of results. Note:
selectOptions
isn’t support in Internet Explorer and I don’t care enough to support
it (and maybe you shouldn’t either).