You can add preserveScroll: false, to the form.put method as an option. See the explanation on the inertia docs: https://inertiajs.com/forms
Aug 24, 2021
3
Level 1
InertiaJS redirect same page after form submit
I'm using the useForm helper. When I submit a PUT request, process the update and return a response to the same page, the scroll position remains the same. How can I set the scroll to the top of the page?
public function update(CustomRequest $request, Account $account)
{
$account->update($request->validated());
return Redirect::route('accounts.edit', $account->id);
}
@submit.prevent="form.put(route('accounts.update', {account: account.id}))"
Please or to participate in this conversation.