© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
Adapt.Patrick

Newly created option isn't selected when returning from createOptionForm()

As per the attached screen recording gif, the selected item in the menu doesn't reflect the newly created record when creating a new entry via the
createOptionForm()
createOptionForm()
method (as below).

Select::make('project_type_id')
  ->columnSpan(6)
  ->hidden(!$userIsAdmin)
  ->options(ProjectType::all()->pluck('type', 'id')->toArray())
  ->relationship('projectType', 'type')
  ->createOptionForm([
      TextInput::make('type')
          ->required()
          ->maxLength(255),
  ])
  ->editOptionForm([
      TextInput::make('type')
          ->required()
          ->maxLength(255),
  ])
  ->manageOptionActions(function ($action) {
      $action
          ->modalWidth('lg')
          ->modalFooterActionsAlignment('end');
  })
  ->preload()
  ->required()
Select::make('project_type_id')
  ->columnSpan(6)
  ->hidden(!$userIsAdmin)
  ->options(ProjectType::all()->pluck('type', 'id')->toArray())
  ->relationship('projectType', 'type')
  ->createOptionForm([
      TextInput::make('type')
          ->required()
          ->maxLength(255),
  ])
  ->editOptionForm([
      TextInput::make('type')
          ->required()
          ->maxLength(255),
  ])
  ->manageOptionActions(function ($action) {
      $action
          ->modalWidth('lg')
          ->modalFooterActionsAlignment('end');
  })
  ->preload()
  ->required()


Expected behaviour
When returning from creating a new entry using the
createOptionForm()
createOptionForm()
method, I expect that item to be auto-selected in the corresponding
Select
Select
menu.
CleanShot_2024-05-14_at_22.22.50.gif
Solution
Try to use
->native(false)
->native(false)
on the select 🤔

Is there a reason why you use both options and relationship?
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

Prevent newly created item from being collapsed
FilamentFFilament / ❓┊help
2y ago
createOptionForm - item not automatically selected
FilamentFFilament / ❓┊help
2y ago
Redirecting to URL from selected option
FilamentFFilament / ❓┊help
3y ago
Multiselect hide Placeholder when option selected
FilamentFFilament / ❓┊help
2y ago