Unable to call component method. Public method [setValue] not found on component
blade file
component
14 Replies
did you set
protected $listeners = ['setValue'];
?Unable to call component method. Public method [$emit] not found on component
Unable to call component method. Public method [emit] not found on component
Is your component actually a livewire component? Otherwise it won’t work the way you are trying to do it.
I am trying to build my own component but it is not described anywhere. Neither in the documentation nor in any Yt video
important thing to remember is that form components aren't Livewire components. you can certainly make your custom form component a Livewire component.
And how can I make my Field Component be a livewire component?
the same way you'd make any livewire component, then you'd just put it in the blade view for your custom field.
I will say though, that there is a reason that fields aren't individual livewire components.
I am currently try to build a filterable checkbox list where I can filter by the checkbox group
But I am struggeling to bind the select where I can select the groups and the saving it to a variable in the component an then filter the checkboxes by the group of the select
Can you give me an example how I can render a livewire component inside a Field Component?
Sorry, i don't have time to put anything together for you. Maybe someone else does, but it's all standard laravel and livewire.
Sorry to bump an old thread -- I actually just ran into this. The docs for Custom Fields seem to imply that individual fields are Livewire components, but doesn't explicitly say "this is not a livewire component, just a Blade component".
For instance, it says:
This is the basis of how fields work in Filament. Each field is assigned to a public property in the Livewire component class, which is where the state of the field is stored. We call the name of this property the "state path" of the field.I'm guessing the "Livewire component class" here is whatever context the Custom Field appears in (e.g. a Page, Widget, etc.)? (I could also be super confused here, trying to build a dynamic custom field)
Yes. For example in the panels, the pages are the livewire components. The form / table goes in the livewire component and the fields go inside the form.
Got it! Thanks for clarifying. That means Alpine's
$wire
(in e.g. a Custom Field) will always refer the parent Livewire component, and that's how we can manipulate livewire state inside nested fields, yeah? So we might not need a nested Livewire componentWell, it's all wired together, so you can update the state of other form components with $get and $set. If they are arrays you just have to traverse the array. But you're not technically wrong.
You can also just use an Alpine component and bind the field's state to the alpine component, that should keep the state of the component in sync with the form's state.
just feels like there might be some over complication going on here.
me, a developer, overcomplicate things? impossible
I have to read the docs more closely -- didn't know about $get and $set.
FWIW I'm writing a wizard with a text input that's an autocomplete/search field. It hits an API on update and populates a radio group below with the results from the API call. I can start a new thread if I run into more hiccups, I know this one's getting a little long. Thanks for all your help!