Closed kevin-DL closed 3 years ago
Hey @kevin-DL ! Thanks for reporting this issue.
I suspect that you're triggering the browser's default form handling mechanism instead of your own.
You might be missing <form @submit.prevent="submit">
to suppress the browser's default behavior.
The official Inertia documentation for forms might help you with figuring out what went wrong:
https://inertiajs.com/forms
Let me know if it helped 😄
@eidellev .Thank you for your response. The @submit.prevent
is there. Now that i look at it the response from the form submission looks like this, do you think that's the reason
{"component":"games/New","props":{"auth":{"loggedIn":true,"user":{"id":1,"email":"xxxx@xxx.com","name":xxxxx","picture":"https://ssssss","remember_me_token":"xxxx","created_at":"2021-08-15T12:39:05.998+01:00","updated_at":"2021-08-16T20:13:01.078+01:00"}},"key":"xxxxxxx","sports":[{"id":1,"name":"Football"}],"game":36},"url":"/games/new?title=sdsdsfsdfsd&date=2021-08-22&time=10%3A58"}
The url field has the form values but the request is a post. I might change the way i do things but i wonder if there is something weird happening.
If i return
inertia.redirectBack()
Then the issue does not happen. It happens only if i call inertia.render
Thanks again for reporting this issue. It's been fixed in v4.1.1
:
https://github.com/eidellev/inertiajs-adonisjs/releases/tag/v4.1.1
Let me know if you run into any additional issues after you upgrade.
Thank you
Hello, i am trying to do a form submission but when i a submit the form and get the response, the url changes to include the posted data into the url. Am i submitting/handling the form wrong?
The form submission
The response from the handler for POST /games/new
Thank you for your help