I've been slowly working on a small library <https://github.com/kintail/input-widget> to make working with the basic input widgets like <select> more pleasant to work with - I'd be interested to see what you think. The implementation <https://github.com/kintail/input-widget/blob/master/src/Kintail/InputWidget.elm#L48> handles the mapping between selected index and strongly-typed values; check out examples/ComboBox.elm <https://github.com/kintail/input-widget/blob/master/examples/ComboBox.elm> to see a simple usage example.
On Tuesday, 25 October 2016 23:45:26 UTC+11, James Hamilton wrote: > > Hello! > > I suppose this really only applies to instances of <option>, but there may > be other examples. > > When using <option> with <select>, it's necessary to set a value on the > <option> using <value> which accepts a String. However, I usually actually > want to refer to a Type which I have to represent as a String and marshal > it back to its correct type when updating the model. > > Is there a way of doing this using a type, and if not could it be done? I > think it's a reasonable thing to expect to be able to do with an <option>, > but then again I'm pretty new to this so please tell me if I'm asking for > something complicated! > > -- 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.
