Edit select form throwing error if not exists

If the select contains a value which does not exist in the relationship option then it throws
Filament\Forms\Components\Select::getEditOptionActionFormData(): Return value must be of type array, null returned
How to hide the form an show empty select. Tried this but still throws the error. If there are invalid data in the database e.g test_id=123 and this does not exist in the database, then the error is thrown when using the edit form
Select::make('test_id')
->relationship('example')
->editOptionForm(self::getFormSchema())
->editOptionAction(function (Forms\Components\Actions\Action $action) {
return $action
->visible(fn ($state, $record) => $state && $record)
Select::make('test_id')
->relationship('example')
->editOptionForm(self::getFormSchema())
->editOptionAction(function (Forms\Components\Actions\Action $action) {
return $action
->visible(fn ($state, $record) => $state && $record)
4 Replies
Patrick Boivin
Patrick Boivin14mo ago
Why is the relationship empty?
exactwebitesolutions
Updated it for clarity it was just to show that it happens when there's a relationship.
BlackShadow
BlackShadow14mo ago
Don´t you need to specify what field? Like ->relationship('relation_name', 'column_name')
cheesegrits
cheesegrits14mo ago
I don't understand how a relationship could be empty. Literally by definition, the options in a relationship Select exist.
Want results from more Discord servers?
Add your server