F
Filament16mo ago
gizmojo

How to modify the form opened from a select option?

E.g I want to adjust the form columns to two, by default it's one. I don't want to use Grid components everywhere. Is there a way of modifying the form from within editOptionAction?
Select::make()
->editOptionForm(CustomResource::getFormSchema())
->editOptionAction(fn (Forms\Components\Actions\Action $action) => $action->modalWidth('screen'))
Select::make()
->editOptionForm(CustomResource::getFormSchema())
->editOptionAction(fn (Forms\Components\Actions\Action $action) => $action->modalWidth('screen'))
Solution:
I found what I needed - you use Closure in editOptionForm to access the form object. ```php ->editOptionForm(fn (Forms\Form $form) => $form ->schema(CustomResource::getFormSchema())...
Jump to solution
4 Replies
josef
josef16mo ago
How do you want to achieve two columns without a Grid?
gizmojo
gizmojoOP16mo ago
In the same way a standard form works
$form
->schema([
// ...
])
->columns(2);
$form
->schema([
// ...
])
->columns(2);
josef
josef16mo ago
Sorry, I don't get what you want to achieve. The form columns should change after the action?
Solution
gizmojo
gizmojo16mo ago
I found what I needed - you use Closure in editOptionForm to access the form object.
->editOptionForm(fn (Forms\Form $form) => $form
->schema(CustomResource::getFormSchema())
->columns()
)
->editOptionForm(fn (Forms\Form $form) => $form
->schema(CustomResource::getFormSchema())
->columns()
)
Want results from more Discord servers?
Add your server