Inertia.js Forms That Behave Like the Web: Validation, Redirects and Partial Reloads

Tim Rabbetts | November 22, 2026

Inertia.js is often introduced as a way to build a single-page experience without creating a separate JSON API. That description is accurate, but it does not explain where many production problems appear. The difficult parts are usually not rendering a page or intercepting a link. They are submitting forms reliably, returning useful validation errors, preserving what a user has typed and refreshing only the data that has actually changed.

The most dependable Inertia.js applications treat forms as enhanced HTML forms rather than miniature API clients. The browser submits through Inertia, the server performs authorisation and validation, and the server responds with a redirect. Inertia then follows that redirect and updates the page without a full browser reload. This approach keeps business rules on the server while allowing the frontend to remain responsive.

This article develops that workflow with Vue and a Laravel-style server example. The concepts also apply to other Inertia adapters, but the exact server-side validation and redirect helpers vary by framework. Before starting, you should have an Inertia application running, a configured client adapter such as @inertiajs/vue3, server-side routes and a normal form submission that you can test in a browser.

Understand the Inertia form lifecycle

An Inertia visit is not the same thing as manually calling fetch() and interpreting a JSON response. After the initial page load, Inertia sends requests with its own headers. When the server recognises an Inertia request, it returns a page object rather than another complete HTML document. The client swaps the current page component and updates browser history.

For a form, the normal lifecycle is:

  1. The user edits fields in a Vue, React or Svelte component.
  2. The component submits data using the Inertia router or form helper.
  3. The server checks authentication, authorisation and validation rules.
  4. On success, the server changes state and redirects to a GET route.
  5. On validation failure, the server redirects back and flashes errors into the session.
  6. Inertia receives the resulting page props and updates the component.

This is deliberately close to a traditional HTML form workflow. The difference is that Inertia handles the visit and component update, so the browser does not need to discard the entire document.

The official Inertia documentation describes this protocol in detail, including the headers and JSON page objects used after the initial request. It is worth reading when debugging middleware, caching, asset versioning or a custom server adapter.

Use the form helper for ordinary forms

For most forms, useForm() is a better starting point than a hand-built reactive object. It tracks submitted values, processing state, validation errors, upload progress and whether the form has changed. It also provides methods for resetting fields and cancelling a visit.

Here is a small profile form using the Vue 3 adapter:

<script setup>
import { useForm } from '@inertiajs/vue3'

const form = useForm({
  name: '',
  email: '',
})

function submit() {
  form.put('/profile', {
    preserveScroll: true,
  })
}
</script>

<template>
  <form @submit.prevent="submit">
    <div>
      <label for="name">Name</label>
      <input
        id="name"
        v-model="form.name"
        name="name"
        autocomplete="name"
        :aria-invalid="Boolean(form.errors.name)"
        aria-describedby="name-error"
      />
      <p v-if="form.errors.name" id="name-error" role="alert">
        {{ form.errors.name }}
      </p>
    </div>

    <div>
      <label for="email">Email</label>
      <input
        id="email"
        v-model="form.email"
        name="email"
        type="email"
        autocomplete="email"
        :aria-invalid="Boolean(form.errors.email)"
        aria-describedby="email-error"
      />
      <p v-if="form.errors.email" id="email-error" role="alert">
        {{ form.errors.email }}
      </p>
    </div>

    <button type="submit" :disabled="form.processing">
      {{ form.processing ? 'Saving…' : 'Save changes' }}
    </button>
  </form>
</template>

The @submit.prevent handler prevents the browser's default full-page navigation. The form helper then submits the data through Inertia. The disabled button is not merely cosmetic: it reduces accidental double submissions while the request is in progress.

Do not rely on the disabled button as a concurrency control mechanism. A user can have multiple browser tabs open, repeat a request, or send a request outside your interface. The server must still enforce uniqueness, authorisation and any other invariants.

Return redirects instead of inventing client-side response handling

A successful write should normally redirect to a GET route. In a Laravel application, a controller might look like this:

<?php

namespace App\Http\Controllers;

use App\Models\Profile;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

final class ProfileController
{
    public function edit(Request $request): Response
    {
        return Inertia::render('Profile/Edit', [
            'profile' => $request->user()->profile,
        ]);
    }

    public function update(Request $request): RedirectResponse
    {
        $validated = $request->validate([
            'name' => ['required', 'string', 'max:100'],
            'email' => ['required', 'email', 'max:255'],
        ]);

        $request->user()->profile()->update($validated);

        return to_route('profile.edit')
            ->with('success', 'Your profile has been updated.');
    }
}

The redirect gives the application a predictable post-submission destination. It also prevents an accidental browser refresh from repeating the original write request, because the page the user is viewing is now the result of a GET request.

For PUT, PATCH and DELETE requests, the follow-up redirect needs to become a GET. Inertia's official server adapters handle the appropriate 303 behaviour automatically in supported integrations. If you are writing or maintaining a custom adapter, verify this rather than assuming every 302 response has the same semantics.

A successful response is not the place to return a large custom JSON object just because the frontend needs to know that the operation worked. Redirect to a page whose props represent the current server state. This keeps the server-side route, authorisation rules and page data aligned.

Let the server own validation

Client-side validation is useful for immediate feedback, but it cannot protect the application. It can be bypassed, become stale or disagree with rules used by another client. The server should validate every value before writing it to a database or passing it to another service.

Inertia's validation model is intentionally different from a typical XHR API. In the common server-adapter workflow, validation failure causes a redirect back rather than a client-visible 422 response. Validation messages are flashed into the session, shared as page props and exposed through form.errors.

That means the component does not need to parse a response body manually:

function submit() {
  form.post('/projects', {
    onError: () => {
      // The server-provided messages are now in form.errors.
      // Focus management can be added here if required.
    },
    onSuccess: () => {
      form.reset()
    },
  })
}

Use the field names sent by the server consistently. If the backend returns an error for email, the input should display form.errors.email. For nested data, agree on a naming convention with your server adapter and test the resulting error keys instead of guessing.

When a page contains multiple forms with similar field names, scope their errors. For example, a page might contain both a “create company” form and a “create user” form, each with a name field. If both forms read from one unscoped error object, an error from one form can appear beside the other form.

import { router } from '@inertiajs/vue3'

router.post('/companies', companyData, {
  errorBag: 'createCompany',
})

router.post('/users', userData, {
  errorBag: 'createUser',
})

The form helper can simplify error scoping in many cases, but explicit error bags remain useful when several independent submissions share a page or when you are using the lower-level router.

Preserve state deliberately

Inertia preserves component state by default for common write requests such as post, put, patch and delete. This is why a failed form submission can redirect back without losing every value the user entered.

Do not assume that every GET visit should preserve state. A search form may benefit from preserved filters, while an edit page might need a clean component after the server has returned a newly saved record. Choose preserveState and preserveScroll based on the user journey.

The form helper also supports explicit reset behaviour:

form.post('/profile', {
  preserveScroll: true,
  onSuccess: () => {
    form.reset('password', 'password_confirmation')
    form.clearErrors()
  },
})

For forms that must survive browser back and forward navigation, give the form a stable key. Inertia can then store the form data and errors in history state. Use a different key for each record when editing multiple records in the same interface.

const form = useForm(`EditProfile:${profile.id}`, {
  name: profile.name,
  email: profile.email,
})

Be careful with sensitive information. Browser history state is not a substitute for secure storage. Do not remember passwords, authentication secrets, payment details or other data that should not remain in browser history. If your application displays sensitive props, review the history and encryption features provided by your Inertia version and server adapter.

Handle file uploads as a separate concern

When form data includes a file, Inertia can convert the request to FormData. The form helper exposes upload progress, which is useful for avatars, documents and media:

const form = useForm({
  title: '',
  document: null,
})

function upload() {
  form.post('/documents', {
    onSuccess: () => form.reset('document'),
  })
}
<input
  type="file"
  @input="form.document = $event.target.files[0]"
  accept=".pdf,application/pdf"
/>

<progress
  v-if="form.progress"
  :value="form.progress.percentage"
  max="100"
>
  {{ form.progress.percentage }}%
</progress>

Validate uploads on the server, including size, MIME type and any content-specific restrictions. Treat the original filename as untrusted input. Store files using generated names and a non-public storage location where possible, then serve them through an authorisation-controlled download route.

Some server frameworks have limitations around multipart requests using PUT, PATCH or DELETE. A common workaround is to send a POST request with a method override, but confirm the supported approach for your adapter before deploying it.

Refresh only the data that changed

After a form succeeds, many applications reload an entire page even though only one region changed. Partial reloads allow a visit to request selected props from the same page component.

Imagine a dashboard containing a large activity feed, a list of projects and a small notification count. Updating a project does not necessarily require recalculating every prop. A targeted reload can request just the projects:

import { router } from '@inertiajs/vue3'

function refreshProjects() {
  router.reload({
    only: ['projects'],
    preserveScroll: true,
  })
}

On the server, expensive props should be evaluated lazily so that they are not calculated when a partial reload does not request them:

return Inertia::render('Dashboard', [
    'projects' => fn () => $request->user()
        ->projects()
        ->latest()
        ->paginate(20),

    'activity' => fn () => $request->user()
        ->activity()
        ->latest()
        ->limit(50)
        ->get(),

    'notifications' => fn () => $request->user()
        ->unreadNotifications()
        ->count(),
]);

Partial reloads are not a universal performance fix. They only apply when the destination remains the same page component, and they can leave data stale if you omit a prop that should have changed. Treat them as an explicit freshness decision. Document which actions invalidate which props, and add tests for the page state users should see after a mutation.

Also inspect the database queries behind each prop. Sending fewer props does not help if the server still eagerly performs all the expensive queries before Inertia filters the response.

Accessibility and security are still server-and-browser concerns

Inertia does not automatically make a form accessible. Use real labels, meaningful input names, keyboard-friendly controls and an error presentation that can be understood by assistive technology. Associate field errors with inputs through aria-describedby, mark invalid fields with aria-invalid and provide a summary for forms with many errors.

After a failed submission, consider moving focus to the first invalid field or to an error summary. Do this without stealing focus from a user who is already navigating deliberately. A polite live region can announce a general success message, while field-level errors remain next to their controls.

On the security side, keep authentication and authorisation in server-side middleware and policies. Never trust a hidden input containing a user ID, role or price. Derive sensitive values from the authenticated user and permitted server-side records. Use the framework's CSRF protection and ensure cookies, session settings and HTTPS are configured correctly for the deployment environment.

Inertia props are data sent to the browser. Do not include secrets, internal tokens or unrestricted model serialisations in shared props. Prefer explicit resource transformations or small arrays of fields that the page actually needs. This reduces accidental disclosure and decreases response size.

A practical production checklist

  • Use useForm() for ordinary forms and disable submission controls while a visit is processing.
  • Validate and authorise on the server, even when client-side validation exists.
  • Return a redirect after successful non-GET requests.
  • Display errors from the form helper rather than parsing ad hoc response formats.
  • Use error bags when multiple forms can produce the same field names.
  • Preserve scroll and component state only when it supports the user journey.
  • Use stable form keys for drafts that should survive history navigation.
  • Never remember passwords or other sensitive values in browser history.
  • Validate uploaded files and store them using safe, generated names.
  • Use partial reloads only when stale props are acceptable and expensive props are lazy.
  • Keep props minimal and never expose secrets or unrestricted database records.
  • Test success, validation failure, duplicate submission, back navigation and expired sessions.

The central idea is simple: Inertia works best when you resist turning every form into a custom client-side protocol. Let the server remain responsible for rules, persistence, redirects and validation. Let Inertia handle navigation, page updates and state preservation. Once that division is clear, forms become easier to reason about, easier to test and much less likely to drift away from the rest of the application.

Further reading

For the protocol and implementation details, read the official Inertia protocol documentation. The official guides for forms, validation, partial reloads, remembering state and file uploads provide the adapter-specific details behind the patterns used here.