Dynamic Wizard Step

Hello together,

I have a problem and no idea how i can solve it. Basically I currently using this https://filamentphp.com/docs/3.x/forms/advanced#dynamic-fields-based-on-a-select-option to show different forms based on an select and fill an json field with this data. Now I want to apply the same method to wizards to add a dynamic schema to an wizard step. I'am currently getting this error Call to a member function getChildComponentContainer() on null. I think it does not find the getComponent because it is not in the scope of the first step.

The getSteps function looks like this:

protected function getSteps(): array

    {

        return [

            Step::make('General')

                ->description('Configure general informations')

                ->schema([

                    Select::make('template_id')

                        ->required()

                        ->relationship('template', 'name')

                        ->live()

                        ->afterStateUpdated(fn (Select $component) => $component

                            ->getContainer()

                            ->getComponent('dynamicService')

                            ->getChildComponentContainer()

                            ->fill()

                        ),

                ]),

            Step::make('Service')

                ->description('Configure service informations')

                ->schema(fn (Get $get): array => $get('template_id') ? \Aura::getServiceByKey(Template::find($get('template_id')))::getTemplateForm() : [])

                ->key('dynamicService')

        ];

    }
Was this page helpful?