F
Filament11mo ago
roni

Position of element in Dependent Select Field Option

I have a status field in a Model, where I want to show specfic set of options in Select Field based on value of status I find that position of element is not correct after selecting and updating a form. Let me explain it with example: If current status is triage and user selects 'in_progress' and save form. then Form shows the correct new options in Select (in_progress, complete, triage) but current selected option it shows is 'complete' whereas its current state is 'in_progress' Can someone please have a look at following code, If I am doing something wrong.
return $form
->schema([
Select::make('status')
->options(fn (Get $get): array => match ($get('status')) {
'triage' => [
'triage' => 'Triage',
'in_progress' => 'In Progress',
'backlog' => 'Backlog',
],
'in_progress' => [
'in_progress' => 'In Progress',
'complete' => 'Complete',
'triage' => 'Triage',
],
default => [
'triage' => 'Triage',
'in_progress' => 'In Progress',
'backlog' => 'Backlog',
],
})
]);
}
return $form
->schema([
Select::make('status')
->options(fn (Get $get): array => match ($get('status')) {
'triage' => [
'triage' => 'Triage',
'in_progress' => 'In Progress',
'backlog' => 'Backlog',
],
'in_progress' => [
'in_progress' => 'In Progress',
'complete' => 'Complete',
'triage' => 'Triage',
],
default => [
'triage' => 'Triage',
'in_progress' => 'In Progress',
'backlog' => 'Backlog',
],
})
]);
}
1 Reply
roni
roni11mo ago
Vento - 17 August 2023
Vento lets you pause, rewind a few seconds, and re-record over any mistakes so you don't have to constantly restart your recordings. Our Software works on Chromebook, Mac, Windows, using Chrome and Edge. Record your computer audio and face as well, no account required with our free Chrome Extension.