Reputation: 24061
Im using vee validate on my inputs, to prevent the form submitting I use:
<form action="/place-to-post-to" @submit.prevent="$validator.validateAll()">
When the form validates, the form does not post. How can I make it post to the action once its valid?
Upvotes: 1
Views: 148
Reputation: 82449
Call validateAll()
in a method and on success, submit the form yourself.
<form action="/path/to/action" method="post" @submit.prevent="onSubmit" ref="theForm">
methods:{
onSubmit(){
this.$validator.validateAll()
.then(() =>{
this.$refs.theForm.submit()
})
.catch((error) =>{
console.log(error)
})
}
}
Upvotes: 1