lukeraymonddowning / honey

A spam prevention package for Laravel, providing honeypot techniques, ip blocking and beautifully simple Recaptcha integration. Stop spam. Use Honey.
MIT License
409 stars 23 forks source link

Unexpected behavior using real-time livewire validation #23

Open isma1206 opened 3 years ago

isma1206 commented 3 years ago

Hi. When I tried to use the livewire function to make a real-time validation:

public function updated($propertyName)
    {
        $this->validateOnly($propertyName);
    }

The errors doesn't work like I expected because only show one error at time if 2 or more fields has errors they just disappear and form only show the current field error. I think because every time one of my models is updated the model "honeyInputs.honey_javascript" is updated to, and the livewire function only expect one property.

I made it work as expect adding this conditional on the function:

public function updated($propertyName)
    {
        if ($propertyName !='honeyInputs.honey_javascript'){
            $this->validateOnly($propertyName);
        }
    }

Maybe you could make something in the future to avoid use this conditional

Thanks for your work your package is very helpful.

lukeraymonddowning commented 3 years ago

Sorry for the delay on this. I'm currently focused on #22, but this is next up.