Closed pambrose closed 1 year ago
Hello,
This is not KVision issue. This is a know browsers bug, originating from HTML 2.0 specification (1995!). Here you an find some more datails:
https://stackoverflow.com/questions/1370021/why-does-forms-with-single-input-field-submit-upon-pressing-enter-key-in-input
Probably the easiest workaround when using FormPanel
with only one field is to add onsubmit
attribute:
formPanel {
setAttribute("onsubmit", "return false;")
// ...
}
Thanks!
Single field forms are not working properly. If a form has more than one field, the onEvent{} for keydown is called as expected. However, if a form has only one field, the onEvent{} for keydown is not called and the page is instead reloaded.
In order to see the issue, please clone this repo https://github.com/pambrose/kvision-issues and run the app.
Thanks, Paul