Thanks Kasey,
I've run into that checkbox rendering issue in the past, when I've needed
some boxes to initialize as "checked". It does take a couple extra steps to
get it working.
Cheers!
On 27 June 2017 at 09:34, Kasey Speakman wrote:
> In addition to the other answers,
Thanks for taking a look!
The true/false code you show is correct - That's the output I'm looking
for. But somewhere in there the value "foo" is getting dropped. Also, the
input type should never change. 'on' should always be a checkbox, 'foo'
should always be text, and 'bar' should always be
In addition to the other answers, I also spotted one other "gotcha" in your
example you may want to be aware of.
Your checkbox does not render the "checked" attribute. Your browser tracks
values for HTML form elements separately from Elm. Form values typically
get overwritten with Elm values
Correct, this is the virtualdom reusing dom-nodes. You may want to use
`Html.Keyed` to help the dom-diffing algorithm out by assigning unique keys
to children that shouldn't be "mixed and matched".
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss"
If you replace the else branch with
[ p [] [] ]
this problem does not seem to happen. I guess, the reason could be the
following: In your version, if model.on is True, we get in total
[ p [] [ text "On: ", input [ type_ "checkbox", onClick Toggle ] [] ]
, p [] [ text "Foo: ", input [ value