F
Filament14mo ago
amir18

multiple forms in one page

Hi im trying to build an admin panel using filament but got stuvk on building more than one form in one page. I dont really know livewire and the only thinf said about the multiple forma in the filament docs was in the context of livewire component https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#using-multiple-forms.
2 Replies
AliBabba420
AliBabba42014mo ago
i have the same doubt and also how to make a raltionship between them like i have the by default user model and i wnt to store the name ,email and password in the user table and other personal details in another table(personal_details) how?
bwurtz999
bwurtz99914mo ago
I think what is relavent here is the mount() function. In Livewire, this is where the component is constructed and it only runs once (on the initial load) If you are trying to use multiple forms on one page, which is definitely possible, you would need to initialize each form in mount() when the page loads This is possible. From the example in the docs, do you see this wire:submit="create" You can change create to whatever you need it to be, and then define that function in the Livewire class
public function create()
{
$data = $this->form->getState();

// save the data however you need
}
public function create()
{
$data = $this->form->getState();

// save the data however you need
}
Want results from more Discord servers?
Add your server