F
Filament6mo ago
negro

Edit Action

how to disable edit action if form field have some value ??
4 Replies
LeandroFerreira
LeandroFerreira6mo ago
Why not a field validation? If the form contains errors, you can't submit it
negro
negroOP6mo ago
It's not what I need I have a toggle field in my form the default value is false and only display on edit. If you set this value to true I don't want to edit the form again
Tetracyclic
Tetracyclic6mo ago
Do you mean hiding the Edit action on the table view for any records that have that field set to true? If so, you can use either the visible(), hidden() or disabled() method on the EditAction. You can pass it a closure that accepts the $record, and return the state of that field:
Action::make('edit')
->hidden(fn ($record): bool => $record->your_field)
Action::make('edit')
->hidden(fn ($record): bool => $record->your_field)
Action::make('edit')
->disabled(fn ($record): bool => $record->your_field)
Action::make('edit')
->disabled(fn ($record): bool => $record->your_field)
negro
negroOP6mo ago
thanks you it works
Want results from more Discord servers?
Add your server