Disable form and show spinner on submit button on form request #935
Answered
by
ajnsn
MuhammadSaim
asked this question in
Help
-
Hi.! I hope you are all doing great. I'm facing an issue while submitting a form using Inertia form helper onStart and onFinish but these callbacks are not setting the vue progress data set to true or false. Thanks export default {
props: {
errors: Object
},
data() {
return {
progress: false,
form: this.$inertia.form({
email: null,
password: null,
_token: this.$page.props.csrf_token
})
};
},
components: {
AppLayout,
Head,
Link
},
methods: {
submit() {
this.form.post(this.route("login"), this.form, {
onStart: () => (this.progress = true),
onFinish: () => (this.progress = false)
});
}
}
}; |
Beta Was this translation helpful? Give feedback.
Answered by
ajnsn
Oct 12, 2021
Replies: 1 comment 2 replies
-
You are setting submit() {
this.form.post(this.route('login'), {
onStart: () => (this.progress = true),
onFinish: () => (this.progress = false),
});
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MuhammadSaim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are setting
this.form
as the 2nd parameter toform.post()
. The method signature isform.post(url, options)
Here is a corrected version that should work: