Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!