© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
GeRaged | Niklas

wire:click is submitting form.

Hey, I try to code a star rating but whenever I click on a star with my own method on it. It submits the form to create the model.

<div {{ $attributes }}>
    @php
        $id = $getId();
        $isDisabled = $isDisabled();
    @endphp
    <div class="flex items-center gap-1">
        @for ($i = 1; $i <= 5; $i++)
            <button wire:click="setValue({{ $i }})">
                @if ($i <= $getValue())
                    <svg class="w-8 h-8 text-yellow-300" style="color: rgb(253 224 71);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
                        <path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
                    </svg>
                @else
                    <svg class="w-8 h-8" style="color: rgb(209 213 219);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
                        <path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
                    </svg>
                @endif
            </button>
        @endfor
    </div>
</div>
<div {{ $attributes }}>
    @php
        $id = $getId();
        $isDisabled = $isDisabled();
    @endphp
    <div class="flex items-center gap-1">
        @for ($i = 1; $i <= 5; $i++)
            <button wire:click="setValue({{ $i }})">
                @if ($i <= $getValue())
                    <svg class="w-8 h-8 text-yellow-300" style="color: rgb(253 224 71);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
                        <path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
                    </svg>
                @else
                    <svg class="w-8 h-8" style="color: rgb(209 213 219);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
                        <path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
                    </svg>
                @endif
            </button>
        @endfor
    </div>
</div>
Solution
wire:click.prevent
wire:click.prevent

is working
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Autofocus after submitting form
FilamentFFilament / ❓┊help
2y ago
Livewire only works with wire:click
FilamentFFilament / ❓┊help
17mo ago
Prevent wire:click in parent element
FilamentFFilament / ❓┊help
2y ago
wire:click result in an exception
FilamentFFilament / ❓┊help
2y ago