Select in custom livewire component with searchable removes wire.model
HI, I have a very weird issue. I have a custom livewire form in a modal. Everything is working really well except when I add the searchable to the select
Which results in html generated like this:
<select x-ref="input" class="h-9 w-full rounded-lg border-none bg-transparent !bg-none choices__input" id="data.company_id" hidden="" tabindex="-1" data-choice="active"></select>
However when I remove the searchable method it does add the wire.model to the select input.
<select class .... wire:model="data.company_id">
When the searchable is removed everything works as you would expect, and loading the value from the database into the form. With the searchable it of course stays empty and gives the error
Livewire Entangle Error: Livewire property ['data.company_id'] cannot be found on component: ['app.filament.pages.planning']
Anybody has seen this before? Or is there something i am missing? Help would be appreciated!
Solution:Jump to solution
Thanks anyway, reduced this to this
public function editAction(): Action
{
return Action::make('Edit')
->requiresConfirmation()...
9 Replies
Are you using a
statePath()
? Did you add $this->form->fill()
in the mount method?I dont have the mount method. I am using a trait which renders the popup and initializes the form. When the record is clicked I call this code:
Do i still need to call this->form->fill on mount?
I am calling the recordClicked method when the item is clicked. That is where the id of the model is passed. How would it work to mount it?
Because I dont think it is the correct way by adding the dialog to every item π
is it a modal? Why aren't you using a modal form?
https://filamentphp.com/docs/3.x/actions/modals#modal-forms
Yep you are totally right. Dont know why I went on the path of completly building the modal with a custom component....
Solution
Thanks anyway, reduced this to this
public function editAction(): Action
{
return Action::make('Edit')
->requiresConfirmation()
->action(function (array $arguments) {
dd($arguments);
// $post = Post::find($arguments['post']);
});
}
π€£
exactly π