Error getEditOptionActionFormData when using editOptionForm in Select without a relationship
Hello.
I have a select:
with the createOptionForm() working correctly now, and I also need the user to be able to edit, so I added the code for the edit:
But when I select one existing data from the dropdown it thows the error:
Filament\Forms\Components\Select::getEditOptionActionFormData(): Return value must be of type array, null returned
Any ideas of how to solve this? I suppose it is not a problem to enable both the createOption and the editOption at the same time. Is it that way?
Thanks.
9 Replies
I am guessing youm need:
editOptionActionFormData([
$data here?
])
this is a new feature I am not familiar with
Yes. I suppose it is something like that, but I have been trying blindly with no success.
Any example could help, please.
editOptionActionFormData(fn($record) => $record)
?
Nope. Already tried but no results.
editOptionActionFormData(fn($record) => $record->toArray())
Can you provide your code I think I know hy
Someone helped me with the createOption
https://discord.com/channels/883083792112300104/1148349791013703720
But with the same idea, edit is not working. If you go to definition on function getEditOptionActionFormData it expects an array and gets it from fillEditOptionActionFormUsing. I tried:
And error now is ==> An attempt was made to evaluate a closure for [Filament\Forms\Components\Select], but [$data] was unresolvable.
The whole code, that's just a fill edit code.
The whole select field code is too long. A file is created but you can see:
same problem. Have you resolve this bug ?
An attempt was made to evaluate a closure for [App\Forms\Components\Select], but [$data] was unresolvable.