Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lara111629's avatar

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}))"
0 likes
3 replies
lara111629's avatar

I've tried adding preserveScroll as false to the put request, but the scroll still remains at the bottom of the form.

Just to confirm, the form is submitting, hitting a 303 status and redirecting back to the page.

@submit.prevent="form.put(route('accounts.update', {account: account.id}), {preserveScroll: false})"

Please or to participate in this conversation.