© 2026 Hedgehog Software, LLC

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

How to set selected on edit form

I have this field

Forms\Components\Select::make('billing')
  ->label(__('Datos de facturación'))
  ->options(function (RelationManager $livewire): array {
      return $livewire->ownerRecord->billings
          ->pluck('name', 'id')
          ->toArray();
  })
  ->searchable()
  ->required()
Forms\Components\Select::make('billing')
  ->label(__('Datos de facturación'))
  ->options(function (RelationManager $livewire): array {
      return $livewire->ownerRecord->billings
          ->pluck('name', 'id')
          ->toArray();
  })
  ->searchable()
  ->required()

How can i set selected value on edit form (its a relationmanager), searching on user_billings table??

I try adding this

->formatStateUsing(function (UserInvoice $record, RelationManager $livewire): ?int {
    return $livewire->ownerRecord->billings->where('nif', $livewire->ownerRecord->nif)->first()?->id;
})
->formatStateUsing(function (UserInvoice $record, RelationManager $livewire): ?int {
    return $livewire->ownerRecord->billings->where('nif', $livewire->ownerRecord->nif)->first()?->id;
})


But it doesn't works

Thanks
Solution
mountUsing in the action?
https://filamentphp.com/docs/3.x/actions/modals#executing-code-when-the-modal-opens
Modals - Actions - Filament
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

How to selected value for edit form
FilamentFFilament / ❓┊help
3y ago
How to show a Badge on Edit Form
FilamentFFilament / ❓┊help
14mo ago
How to load action form quicker on edit page?
FilamentFFilament / ❓┊help
14mo ago
edit form
FilamentFFilament / ❓┊help
3y ago