Reputation: 1479
I need to insert <form>
into the DOM. Otherwise password managers like LastPass doesn't work and you cannot submit it by hitting enter on your keyboard. I could not find a better way than converting whole content of <form>
to Html msg
from Element msg
and back again. This is really inefficient.
insertForm : List (Element msg) -> Element msg
insertForm elements =
html
(Html.form []
[ layout []
(column [] elements)
]
)
I'm sure there must be a better way. But I could not find it anywhere in elm-ui docs.
Upvotes: 4
Views: 407
Reputation: 24399
If you search the elm-ui repo for "form" and look through the code, you will find that Html.form
is not invoked.
Therefore, the way to do it is as you have shown, which is to use Element.html
.
You claim "This is really inefficient.". That claim is false. elm-ui must store a representation of Element
internally, then convert that to elm/html
's Html at the end. There is nothing inefficient about wrapping and storing Html
directly and outputting it at the end. That's actually the least amount of work elm-ui has to do, because you've already done the work of generating the actual Html
you want.
Upvotes: 6