|
I am using EditForm in Blazor and I have a complex form with multiple input components. I want to prevent the form from being submitted when the user presses the Enter key, as this can cause unwanted or incomplete submissions. This is especially problematic with HxInputTags (#585) or HxAutosuggest (#584), where the user may want to use the Enter key to confirm their input. I have found this StackOverflow discussion EditForm - How can I prevent submit on pressing enter key addresses this issue, but I am not sure which solution is the best or the most recommended. Some of the possible solutions are:
I suppose that this is a common problem and you may have already solved it in some way. |
Replies: 3 comments 3 replies
|
Hello, we are using the JavaScript to intercept the keydown event in some scenarios ( ...this does not seem to relate to our components directly, therefor I'm closing this issue and moving it to discussions. If you feel there is something specific we should do on our side (in addition to those two very specific issues you filled under #584 and #585), feel free to create a ticket. |
|
I understand that you intercept the keydown event on some components and don't take into account whether the user presses enter on e.g. a textbox and submits the form by accident. |
|
From you answer I understand that your general practice is something like following code Am I correct? |
No, see this showcase project:
EditContext+OnValidClickusage on<SaveButton />(interchangeable withHxButton, just a custom visual)editContexthas to be created manually