© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
dotdotdot

Select input value not being set

class LogTrips extends Component implements HasForms
{
    use InteractsWithForms;

    public ?array $data = [];

    public function mount(): void
    {
        $this->form->fill();
    }

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('from_id')
                    ->native(false)
                    ->options(fn () => Station::get()->pluck('name', 'id')),
                Select::make('to_id')
                    ->options(fn () => Station::get()->pluck('name', 'id'))
                    ->native(false),
                TextInput::make('fare')
                    ->suffix('TND')
                    ->required()
                    ->columnSpanFull()
                    ->minValue(0.900)
                    ->maxValue(80)
                    ->numeric(),
            ])->columns(2)
            ->statePath('data');
    }

    public function create(): void
    {
        dd($this->form->getState());
    }

    public function render(): View
    {
        return view('livewire.log-trips');
    }
}
class LogTrips extends Component implements HasForms
{
    use InteractsWithForms;

    public ?array $data = [];

    public function mount(): void
    {
        $this->form->fill();
    }

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('from_id')
                    ->native(false)
                    ->options(fn () => Station::get()->pluck('name', 'id')),
                Select::make('to_id')
                    ->options(fn () => Station::get()->pluck('name', 'id'))
                    ->native(false),
                TextInput::make('fare')
                    ->suffix('TND')
                    ->required()
                    ->columnSpanFull()
                    ->minValue(0.900)
                    ->maxValue(80)
                    ->numeric(),
            ])->columns(2)
            ->statePath('data');
    }

    public function create(): void
    {
        dd($this->form->getState());
    }

    public function render(): View
    {
        return view('livewire.log-trips');
    }
}


from_id and to_id are not being set.
if I use
->native(true)
->native(true)
it works though
image.png
Solution
thank you for the hint!

solved by doing this:
OIEHF918.png
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Select input value not set in dynamically created Tab component
FilamentFFilament / ❓┊help
2y ago
Default value in Select input
FilamentFFilament / ❓┊help
2y ago
set default value for select
FilamentFFilament / ❓┊help
3y ago
Set default value to a select, listening the change from another input
FilamentFFilament / ❓┊help
3y ago