Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
Process an HTML Form without the Submit Button Using VeeValidate

I've created a form handler using its composable inside my <script setup>:

const { submitForm, resetForm, handleSubmit, meta } = useForm()

function save() {
  // Here I want to submit the form

  submitForm() // This doesn't work
  showSaveSnackbar.value = false
}

function discard() {
  resetForm()
  showSaveSnackbar.value = false
}

const onSubmit = handleSubmit(values => {
  // pretty print the values object
  alert(JSON.stringify(values, null, 2));
});

And in my template I wrote this:

<form @submit="onSubmit">
    <!-- inputs -->

</form>

I made a snackbar with a button that shows up (using useForm's meta.dirty attribute). When I edit the form and I want to submit it, I want to use this custom button instead of the HTML Form's Submit button (in this case the button calls the custom save() function).

I tried using the submitForm() function but without success.

How can I do this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think you can handle the form processing in the save function (and possibly remove the onSubmit function).

const { errors, values } = useForm();

const save = () => {
  showSaveSnackbar.value = false
  alert(JSON.stringify(values.value, null, 2));
};
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda