© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•11mo ago•
5 replies
Alberto

Force select value based on a toggle option

I have a select value with three possible values (0 ,1, 2) ,next to it I've a toggle, when the toggle is true, the select value must be 2.

So on my Toggle I'm using ->reactive()->afterStateUpdated( to update the select value, and on my select I'm using disabled(fn ($get) => $get('my_toggle') === true).

The problem is that now the select values does not gets submitted, so the value is never updated. Is there a "pretty" way to do it ? As there's no readonly method on Select.

I could use a hidden field, and update it, but looks messy.

Thnx for your help!
Solution
ssooo

    ->disableOptionWhen(fn (string $value, $get): bool => ($get('my_toggle') === true && $value !== '2'))
    ->disableOptionWhen(fn (string $value, $get): bool => ($get('my_toggle') === true && $value !== '2'))
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Select Option Disabled Based on Another Field's Value
FilamentFFilament / ❓┊help
12mo ago
Hide a Toggle field depending on Select option
FilamentFFilament / ❓┊help
3y ago
Dynamic fields based on a select option
FilamentFFilament / ❓┊help
3y ago
Update a field based on select value
FilamentFFilament / ❓┊help
2y ago