Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

xr0m3oz's avatar

how to handle the before event in createOptionForm modal form

I have a problem, I can't figure out how to handle the before event in createOptionForm modal form

    ->before(function () {
        // Runs before the form fields are saved to the database.
    })

Full code

                Forms\Components\Select::make('agreement_id')
                    ->searchable()
                    ->preload()
                    ->relationship('agreement')
                    ->editOptionForm(AgreementResource::getForm())
                    ->createOptionForm(AgreementResource::getForm())
                    ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->getShortNameAttribute()}"),
0 likes
1 reply
xr0m3oz's avatar

I also can't figure out why creating and editing in a popup doesn't use the same create and edit page. Normally they should use the same code.

Please or to participate in this conversation.