Closed cmbro closed 5 years ago
does this work any better? https://codepen.io/WebReflection/pen/MLRPaz?editors=0010
also bear in mind events in HTML are lowercase so that onclick=${...}
or onchange=${...}
should result into onclick()
and onchange()
methods
Thanks so much for that quick response and for the advice.
I didn't understand at first until I realized that null and an empty string are not the same. So the way I was doing it, there was no change in the data thus no update. It makes sense, it just didn't click until you pointed it out.
Many thanks!
I am not sure if this is an issue or simply my issue of not understanding something. I have setup this codepen to demonstrate: https://codepen.io/cmbro/pen/QYPrzO
I put the issue in the comments there. This is a simplified example to demonstrate; here is the code from that pen with the issue in the comments:
1) Enter text with the letter a in it. Everything works. Click the reset button and that works
2) Now enter text without the letter a so that the input does not pass the simple validation test The input does not get updated (the validate function sets the value to null) The reset button doesn't work
Doesn't work means: My expectation is that the input is cleared due to state.fields.name.value being null, but that doesn't happen. The console log just before the render shows that the value is what I expect, but it isn't being rendered.