Before I applied new livewire V2 programming style I had a form that was wired to a Model's individual properties. To trigger the real time validation for fields, I used this in the component (e.g. name property):
public function updatedName(){
$this->validate(['name' =>'required|max:127']);
}
name being a property of a Model named Malt. My question is: how to modify this updatedName() function ?
I already understood that I should rename the function to updatedMaltName, thus I tried this.
public function updatedMaltName(){
$this->validate(['name' =>'required|max:127']);
}
but it doesn't work. Instead it display an error "The name field is required" as soon as I type a char in the field (which is the opposite of what should happen), and never hide this error even if I empty the field.
I also tried this
public function updatedMaltName(){
$this->validate(['malt.name' =>'required|max:127']);
}
but this doesn't work at all.