F
Filament12mo ago
jeph

Validation won't work with Form and Table on one component

Hi there guys! I have Form and Table in a single livewire component. I am using the form to make a more complex query for my table. I need to validate the field on my forms but validation wont work automatically maybe because I am not saving something to the database and it is a livewire component, not an admin panel or filament page. When I do
public function submit(): void
{
$this->form->validate();
.....
}
public function submit(): void
{
$this->form->validate();
.....
}
It doesn't work. Probably because I have both Form and Table in the same livewire component. When I do
public function submit(): void
{
$this->validate();
.....
}
public function submit(): void
{
$this->validate();
.....
}
The validation works when there is an error (i got some error message). But when there is no error, I would get database error:
Typed property App\Livewire\Domaintable::$table must not be accessed before initialization
Typed property App\Livewire\Domaintable::$table must not be accessed before initialization
I tried removing the table from the livewire component and
public function submit(): void
{
$this->form->validate();
.....
}
public function submit(): void
{
$this->form->validate();
.....
}
already works. It seems that there is a conflict with $this->form when I'm using both Form and Table in the same livewire component. But I really need both Form and Table in the same livewire component for this task. Maybe you can help me find solution. Thanks a lot! By the way, what I want to put validation are the fields min max price range, from to date range and min max domain length.
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server