© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
5 replies
morty

Dependent select without parent being saved to the database

I have a simple form based on a
WorkOrder
WorkOrder
. A
WorkOrder
WorkOrder
belongs to an
Equipment
Equipment
. An
Equipment
Equipment
belongs to a
Location
Location
. Therefore, a
WorkOrder
WorkOrder
belongs to a location through an
Equipment
Equipment
.

I have a dependent select working for the most part:

Forms\Components\Select::make('location_id')
    ->label('Location')
    ->options(...)
    ->live()
    ->dehydrated(false)
    ->afterStateUpdated(fn (Forms\Set $set): null => $set('equipment_id', null))

Forms\Components\Select::make('equipment_id')
    ->label('Equipment')
    ->options(fn (Forms\Get $get): array => Equipment::query()->...),
Forms\Components\Select::make('location_id')
    ->label('Location')
    ->options(...)
    ->live()
    ->dehydrated(false)
    ->afterStateUpdated(fn (Forms\Set $set): null => $set('equipment_id', null))

Forms\Components\Select::make('equipment_id')
    ->label('Equipment')
    ->options(fn (Forms\Get $get): array => Equipment::query()->...),


My problem is on form hydration though when editing the
WorkOrder
WorkOrder
. Since there is no
location_id
location_id
on the
WorkOrder
WorkOrder
table, it obviously doesn't fill the location. I need to somehow fill the location based on the selected equipment instead and that's where I'm stuck. Any ideas?
CleanShot_2025-01-09_at_08.54.42.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

dependent select filter
FilamentFFilament / ❓┊help
2y ago
Dependent select searchable
FilamentFFilament / ❓┊help
3y ago
Dependent select input
FilamentFFilament / ❓┊help
3y ago
Disable dependent select
FilamentFFilament / ❓┊help
3y ago