How to submit form when pressing enter


I presently have a form which has several inputs and a button. The button is configured with a submit behavior and when pressed, the logic in “On Submit Event” for the form is executed.

If I want to do the same when the enter key is pressed in the inputs, then I use the “On Key Down Event” and check if the Key Code = 13 and if so execute the same logic.

The sad thing is this logic has to be copied from the form’s “On Submit Event”. What I am looking for is to submit the form when pressing enter. But I have not found this block. And when trying to write a custom code block with formComponent.el.submit() then the form is submitted but the whole application reloads (!)

Could you suggest a way to do this ? Thanks !

Hi Nicolas Remy!

Submit should be triggered by default on the Enter key. I just checked and everything works correctly.


1 Like

Thanks. Good to know !