Answer the question
In order to leave comments, you need to log in
How in Vue to abort form submission on pressing enter on input?
There is a form. It has an autocomplete field. So when focus is on it and you press enter, the form flies away. How can this be interrupted?
<form class="form form-settings" @submit.prevent="send">
<input type="text" v-model="city" />
</form>
methods: {
send: function () {
}
}
Answer the question
In order to leave comments, you need to log in
The fact is that if there is only one input field in the form, then, according to the specification , pressing enter should lead to submitting the form:
When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form.
@keypress.enter.prevent
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question