Is it possible to open modal on change the status of Select Field ?

In laravel filament form is it possible to open modal on change the state of select dropdown ?
Solution:
then open it with ->afterStateUpdated(fn ($livewire, $component) => $livewire->mountFormComponentAction($component->getStatePath(), 'ACTION NAME HERE'))
Jump to solution
6 Replies
Asmit Nepali
Asmit NepaliOP6mo ago
While changing the status.
Dan Harrin
Dan Harrin6mo ago
Have you registered the action to the form component? thats the first step
Asmit Nepali
Asmit NepaliOP6mo ago
Group::make()
->schema([
Section::make('Submission Status')
->schema([
Select::make('status')
->live()
->required()
->options(ApprovalStatus::class)
->default(ApprovalStatus::PENDING),
])->hiddenOn(['create']),

Section::make('Placement Date Info')
->schema([
Datepicker::make('start_date')
->native(false),
Datepicker::make('end_date')
->after('start_date')
->native(false),
])->visible(fn ($get) => $get('status') === ApprovalStatus::APPROVED->value),
]),
Group::make()
->schema([
Section::make('Submission Status')
->schema([
Select::make('status')
->live()
->required()
->options(ApprovalStatus::class)
->default(ApprovalStatus::PENDING),
])->hiddenOn(['create']),

Section::make('Placement Date Info')
->schema([
Datepicker::make('start_date')
->native(false),
Datepicker::make('end_date')
->after('start_date')
->native(false),
])->visible(fn ($get) => $get('status') === ApprovalStatus::APPROVED->value),
]),
Here I want to show this code on modal when the satus is approved
Section::make('Placement Date Info')
->schema([
Datepicker::make('start_date')
->native(false),
Datepicker::make('end_date')
->after('start_date')
->native(false),
])->visible(fn ($get) => $get('status') === ApprovalStatus::APPROVED->value),
Section::make('Placement Date Info')
->schema([
Datepicker::make('start_date')
->native(false),
Datepicker::make('end_date')
->after('start_date')
->native(false),
])->visible(fn ($get) => $get('status') === ApprovalStatus::APPROVED->value),
Solution
Dan Harrin
Dan Harrin6mo ago
then open it with ->afterStateUpdated(fn ($livewire, $component) => $livewire->mountFormComponentAction($component->getStatePath(), 'ACTION NAME HERE'))
Asmit Nepali
Asmit NepaliOP6mo ago
Thank You @Dan Harrin It worked!, You save my whole day !
Want results from more Discord servers?
Add your server