© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
Veur

CreateOptionForm is not showing

I have a working form that contains a select field to set a user's city_id. I'm trying to add a createOptionForm, but the modal won't show up (but there is network activity, see video).

This is the code of the form:

protected function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('city_id')
                    ->label('Select city')
                    ->relationship('city', 'name')
                    ->preload()
                    ->required()
                    ->createOptionForm([
                        TextInput::make('name')
                            ->label('City')
                            ->required(),
                    ]),
            ])
            ->model($this->user);
    }
protected function form(Form $form): Form
    {
        return $form
            ->schema([
                Select::make('city_id')
                    ->label('Select city')
                    ->relationship('city', 'name')
                    ->preload()
                    ->required()
                    ->createOptionForm([
                        TextInput::make('name')
                            ->label('City')
                            ->required(),
                    ]),
            ])
            ->model($this->user);
    }


And the relationship in the User model:

    public function city()
    {
        return $this->belongsTo(City::class)
            ->withDefault([
                'name' => 'Unknown',
            ]);
    }
    public function city()
    {
        return $this->belongsTo(City::class)
            ->withDefault([
                'name' => 'Unknown',
            ]);
    }
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

CreateOptionForm is not showing
FilamentFFilament / ❓┊help
3y ago
slug is not generated within createOptionForm
FilamentFFilament / ❓┊help
2y ago
createOptionForm is not saving the created record
FilamentFFilament / ❓┊help
3y ago
createOptionForm not checking policys
FilamentFFilament / ❓┊help
2y ago