F
Filament10mo ago
Andi

Accessing form data in suffixAction form.

Hi guys I'm currently trying to access data from the parent form in the suffixActions form. Here's my code:
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('part')
->reactive()
->suffixAction(
Action::make('add')
->action(function (array $data, Forms\Get $get) {
$get('part'); // returns correct value
})
->form([
Forms\Components\Select::make('bom')
->live()
->options(function (Forms\Get $get, $state) use () {
$get('part'); // is null
})
])
)
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('part')
->reactive()
->suffixAction(
Action::make('add')
->action(function (array $data, Forms\Get $get) {
$get('part'); // returns correct value
})
->form([
Forms\Components\Select::make('bom')
->live()
->options(function (Forms\Get $get, $state) use () {
$get('part'); // is null
})
])
)
So in action() I receive the correct value, in options I don't. Thanks for your help.
1 Reply
Tim van Heugten
Tim van Heugten10mo ago
Why are you not using createOptionForm and createOptionUsing on the select?
Want results from more Discord servers?
Add your server