F
Filament2mo ago
Mike.

How to disabled select in form

i have this code Select::make('status') ->label('Status') ->required() ->options(collect(InvitationStatus::getValues()) ->filter() ->mapWithKeys(fn ($value) => [$value => ucfirst($value)]) ->toArray() ) ->default(InvitationStatus::PENDING->value) ->afterStateHydrated(fn ($set, $state) => $state ?: $set(InvitationStatus::PENDING->value)), but i want to select this disabled,when i try to add '->disabled()' it gets error "General error: 1364 Field 'status' doesn't have a default value" can someone help me
Solution:
Using ->dehydrated() at the end ensures the field is included in form submission even when disabled
Jump to solution
1 Reply
Solution
Selva
Selva2mo ago
Using ->dehydrated() at the end ensures the field is included in form submission even when disabled
Want results from more Discord servers?
Add your server