New Record Modal does not work in Select Form

I have a Select button that draws options from the database. I also want the user to be able to create a new category in case it doesnt exist in one of the available options. However, when I press the add button, it changes into a loading icon for a bit then reverts back to the original + icon. The modal does not appear at all. Here is the code used for it:
Select::make('category')
->model(Project::class)
->relationship(name: "task_category", titleAttribute: "name")
->createOptionForm([
TextInput::make('name')
->label('category name')
->required(),
TextInput::make('code')
->label('category code')
->required()
])
->label('select task category')
Select::make('category')
->model(Project::class)
->relationship(name: "task_category", titleAttribute: "name")
->createOptionForm([
TextInput::make('name')
->label('category name')
->required(),
TextInput::make('code')
->label('category code')
->required()
])
->label('select task category')
No description
Solution:
Okay, it turns out you need to add
<x-filament-actions::modals/>
<x-filament-actions::modals/>
to the livewire component's blade file. Thanks for taking the time though!...
Jump to solution
2 Replies
pechtelt
pechtelt2mo ago
Don't know for sure but try to help: - What is the relation between user and category I have an working version and did it like this: ->createOptionForm(function () { return [ TextInput::make('name') ->label('Name') ->required() ->unique(), Hidden::make('user_id')->default(Auth::id()), ]; }) ->createOptionUsing(function (array $data): int { return ContactList::create($data)->id; }), Again, don't know for sure but hope this helps!
Solution
Erdos Holland
Erdos Holland2mo ago
Okay, it turns out you need to add
<x-filament-actions::modals/>
<x-filament-actions::modals/>
to the livewire component's blade file. Thanks for taking the time though!
Want results from more Discord servers?
Add your server