Brilliant. Thanks!

On Tuesday, August 23, 2016 at 12:04:52 AM UTC-5, Gabe Krambs wrote:
>
> Let's say I have a select element to choose a person, and I want to have a 
> certain person, say with id = 3, to be initially selected. How do I pass 
> this id down into my options, and then set the selected attribute to True 
> in that options?
>
>
> Some sample code:
>
>
> personSelect : List Person -> String -> Html Msg
> personSelect : personList selectedId =
>     div []
>         [ select [] (List.map personOption personList) ]
>
>
> personOption : Person -> Html Msg
> personOption : person = 
>     option [ value (toString person.id) ] [ text person.name ]
>
>
> Specifically, how do I get "selectedId" passed to "personOption"? Can I 
> even do this using List.map?
>
>
> Thanks very much!
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to