input in modal doesn't work

I defined a modal in my form, but I doesn't work, I mean when I submit the main form the create-query doesn't include the input that I put in the modal,
public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Wizard::make([
                    Wizard\Step::make('First Step')
                        ->schema([
                            TextInput::make('title')->required(),
                            Forms\Components\Actions::make([
                                Action::make('Custom Modal')
                                    ->button()
                                    // ->icon('heroicon-m-price')
                                    ->form([
                                        TextInput::make('price')->prefix('€')->required(),
                                    ])
                                    ->action(function (Set $set, Get $get) {
                                        $set('price', $get('price'));
                                    }),
                            ]),
                        ]),
                    //...
                ]),
            ]);
    }


SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'price' cannot be null.
Solution
After testing a lot of ways, Now this is the answer:
....
Wizard\Step::make('First Step')
    ->schema([
        TextInput::make('title')->required(),
        Hidden::make('price'),
        Forms\Components\Actions::make([
            Action::make('Custom Modal')
                ->button()
                ->form([
                    TextInput::make('price')->prefix('$')->required()
                    ->default(
                        function (MyModel $record = null) {
                            return  $record?->price;
                        }
                    ),
                ])
                ->action(function (Set $set, array $data) {
                    $set('price', $data['price']);
                }),
        ]),

    ]),
....
Was this page helpful?