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

arsalan_ahmed_siddique's avatar

Wire:submit not working

I am using livewire 3.3 when I try to user wire:submit just refresh the page even if I am using wire:navigate all over te project. below are my component code

<?php

namespace App\Livewire;

use Livewire\Attributes\Validate;
use Livewire\Component;

class CreatePost extends Component
{
    #[Validate('required')]
    public $title = '';

    #[Validate('required')]
    public $content = '';

    public function save()
    {

        $this->validate();

        dd('all');

        return $this->redirect('/post/create', navigate: true);
    }

    public function render()
    {
        return view('livewire.create-post');
    }
}

My blade file

@extends('layouts.app')
@section('content')
<div>
    <form wire:submit="save">
        <input type="text" wire:model="title">
        <div>
            @error('title') <span class="error">{{ $message }}</span> @enderror
        </div>

        <input type="text" wire:model="content">
        <div>
            @error('content') <span class="error">{{ $message }}</span> @enderror
        </div>

        <button type="submit">Save</button>
    </form>
</div>
@endsection
0 likes
14 replies
vincent15000's avatar

That means that $this->validate(); returns false, then you think that it just refreshed the page.

Try to add dd('before validation'); before the validation, you will see that the dd() displays the message on the screen.

1 like
arsalan_ahmed_siddique's avatar

@vincent15000 yes I am using some more components with Livewire:navigate, navigate is working fine but

wire:click
wire:submit
wire:model

These are not working. My mount method mounting the attributes to the blade but not updating the attributes also

Snapey's avatar

check your console for javascript errors?

2 likes
vincent15000's avatar

@Merklin Livewire doesn't use the CSRF token, but a checksum. So it's not useful to add the CSRF token, it's absolutely useless.

1 like
im-nazmul's avatar

You can prevent it by just modifying your code like this,

 <form wire:submit.prevent="save">
	...
</form>

That will prevent page refreshing on form submissions.

Please or to participate in this conversation.