docs-content
docs-content copied to clipboard
FormKit does not fire change events: be more explicit about this
Finding out that FormKit components do not fire @change
events is kind of important I think. Unfortunately it took me 45 minutes to find this out, others may be as surprised.
Others are also confused:
- https://github.com/formkit/formkit/issues/294
- https://github.com/formkit/formkit/issues/961#issuecomment-1731923522
(and probably others)
I think the docs are not explicit enough about this: https://formkit.com/essentials/inputs#events
My suggestions are
- To be explicit in this and state that it's different from browser-native events.
- Link to an explanation of why FormKit chose this so interested people can understand the why.
- Provide a simple example of how to achieve this in FormKit (using FormKit best practices).
Well just to be clear @nielsbom, formkit fires any/all native events just like the browser. If you use @change
on an input that supports the change event it will work just fine. There is no @change
event for multiple checkbox inputs.
My main concern with listing all the parts of native HTML that also apply or do not apply to FormKit is that the HTML spec is very big, and I’m not entirely sure that FormKit should be the place where people learn about these standards. Perhaps we could be more explicit about how FormKit passes all event bindings through to the underlying input and then point people to MDN to read up on what event do exist in native HTML.