Submit form on enter

Hello,

I have a form with one text field and I’d like to let users submit when using the “Enter” key on their keyboards. How would I do it?

Thank you.

Simply use onKeyPress instead of the onClick function.
https://www.wix.com/corvid/reference/$w.TextInputMixin.html#onKeyPress

Something like this:

export function inputButton_keyPress(event) {
  if (event.key === "Enter") {

Thank you for your reply.
How do you trigger the form submission in the “if statement” ?

Add a regular button and use onClick/onKeypress event handler.
From there you can submit the form bound to a dataset using

$('#dataset1').save()

(replace #dataset1 with actual ID of your dataset)

You can add event handlers by clicking + in the properties panel.

Just add it right under the if line above.