Vuejs form not submitting on "enter" Vuejs form not submitting on "enter" vue.js vue.js

Vuejs form not submitting on "enter"


Make sure that your form has either

<button type="submit">Submit</button>

or

<input type="submit" value="Submit" />

If you don't want to show the button, you can use

<input type="submit" style="position: absolute; left: -9999px"/>

You can find more information about hiding the button in this question Submitting a form by pressing enter without a submit button


I tried many different solutions and none worked for me. Maybe because I had several buttons in my form of which only one was supposed to submit the form.

This was what finally worked:Use @keyup.enter on the last element of your input like so:

<input type="text" @keyup.enter="save" />

This way the form will be submitted when the user presses enter right after they fill in the last field of your form.

P.S.In my case I had a <v-text-field> instead of an <input> but it should make no difference.