Home > Enterprise >  How to submit a form when enter key is pressed in an input?
How to submit a form when enter key is pressed in an input?

Time:07-11

How can I modify my q-input so when I press enter key in it, it will submit the q-form instead of go in a new line ? Thank you ! :)

<q-form ref="urlForm" greedy @submit="saveUrl">
  <q-card-section>
    <!-- url -->
    <q-input
      v-model="url"
      :label="t('url')"
      :rules="[urlValidator]"
      outlined dense autogrow autofocus
    ></q-input>
  </q-card-section>
  <q-card-section >
    <q-btn  type="submit" color="positive" :loading="saving" :disable="saving">{{ t('SaveChanges') }}</q-btn>
  </q-card-section>
</q-form>

CodePudding user response:

My bad this is because of the autogrow in q-input.

  • Related