FilamentF
Filament11mo ago
Buddie

Issue with the select multiple state

Hey everyone,

I’m running into an issue with the Select component in Filament. When I enable the multiple() option, the selected values return null in the save() method, even though I’ve selected options.

public function form(Form $form): Form
{
    return $form
        ->schema([
            Select::make('unique_identifier')
                ->label('Select the fields for the unique identifier')
                ->multiple()
                ->options($this->csvHeaders)
        ])
        ->statePath('data');
}

public function save()
{
    $data = $this->form->getState();
    dd($data);
}


When i remove the multiple() from the select component, $data shows the selected value, but i want to be able to select multiple items and save them a certain way.

Maybe it's something small, but i can't seem to get it to work.
Thanks in advance 😄
Was this page helpful?