Inserting livewire component into a form, how to manage state?
Hello, following this section of the documentation: https://filamentphp.com/docs/3.x/forms/advanced#inserting-livewire-components-into-a-form
I have a wizard form with 3 steps to create a record of a resource.
The first two steps uses filament TextInput fields, the third step uses a livewire component.
When creating the record, the first two fields are automatically synced in the form state so when I create the record and inspect the data:
I have the values of the TextInput fields correctly:
My question is: How can I access the state of the form fields within the livewire component
So when creating the record, I expect to have this output:
This is the livewire component:
I have a wizard form with 3 steps to create a record of a resource.
The first two steps uses filament TextInput fields, the third step uses a livewire component.
When creating the record, the first two fields are automatically synced in the form state so when I create the record and inspect the data:
I have the values of the TextInput fields correctly:
My question is: How can I access the state of the form fields within the livewire component
Livewire::make(AppointmentSlotField::class) and set new values to the form?So when creating the record, I expect to have this output:
This is the livewire component:
Solution
You can't do that, you would need to create a Filament Field component, opposed to a custom livewire component which does what you component does, just extends field opposed to component.