Multiple forms page
I am using multiple forms in filaments and when I initialise
$this->form->fill()
in mount. Property [$form] not found on component: [v1.admin.messaging.send-s-m-s]
, this doesn't happen in single form. And when I comment out
$this->form-fill()`, I get this . How do I resolve it??15 Replies
Solution
public ?array $data = [];
It needs to be initially set in this case.
@awcodes Thank you!!!
@awcodes
$this->form->fill()
has now thrown an error Property [$form] not found on component: [v1.admin.messaging.send-s-m-s]
You’re also missing the HasActions interface and the InteractsWithActions trait
This happens when comment out the
$this->form->fill()
Would need to see more code to help more. Also the blade view.
I’m thinking you’ve missed some steps. https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component
@awcodes
You have multiple forms so you need to match your statePath for each one, you’ll need two different arrays to store the data, and in mount it would be $this->singleForm->fill(), etc.
And in the view {{ $this->singleForm }}
The error is correct there is no $form because you have redefined it to the two names on your getForms method.
@awcodes this is the results after making the change.
That’s not correct
$this->singleForm->fill()
‘form’ doesn’t exist anymore. It’s now ‘singleForm’ and ‘massSMSForm’@awcodes I am really really GRATEFUL
No worries.