F
Filamentβ€’11mo ago
Harvey

How to add field error manually in Livewire component

I have a custom Livewire component with a form(), and I need to give a field an error message after submission. The field is called "code", and I need to add an error message of "Invalid code" only after they have submitted the form. I assumed I would just do $this->addError('code', 'Invalid code') but I cannot see it, am I missing a prefix or something? Or have I missed something in the docs?
Solution:
probably the getStatePath(). You can try $this->addError('data.code', 'Invalid code') Share the whole code please...
Jump to solution
2 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’11mo ago
probably the getStatePath(). You can try $this->addError('data.code', 'Invalid code') Share the whole code please
Harvey
HarveyOPβ€’11mo ago
Perfect thanks, this worked πŸ™‚
Want results from more Discord servers?
Add your server