F
Filamentβ€’11mo ago
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). I'm on the latest Filament version, and the form is loaded in a custom Livewire component (outside a Panel). 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);
}
public function city()
{
return $this->belongsTo(City::class);
}
BTW: the form is loaded in a https://wire-elements.dev/pro SlideOver from @Philo
Solution:
Did you add <x-filament-actions::modals /> ?
Jump to solution
2 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’11mo ago
Did you add <x-filament-actions::modals /> ?
Veur
VeurOPβ€’11mo ago
That was it, thanks @Leandro Ferreira! πŸ™‚ I thought that wasn't needed anymore in V3
Want results from more Discord servers?
Add your server