Manually mark input with error

Hi! Is there any way i can mark a field as if it has an error. So for example when manually triggered i want to make it as if has a custom error.
Solution:
Okay, so trying what you said I achived it by calling $this->addError directly on the livewire class
Jump to solution
6 Replies
LeandroFerreira
LeandroFerreira6mo ago
"mark", what does it mean?
calexandre
calexandreOP6mo ago
So that i can manually trigger a validation error For example if i want a textinput to be red because it's discrepant with the data in the database or a fixed value, i want to manually be able to trigger that input's validation error
LeandroFerreira
LeandroFerreira6mo ago
I think you can inject $livewire and use $livewire->addError('field', 'message') or data.your_field https://livewire.laravel.com/docs/validation#manually-controlling-validation-errors
Laravel
Validation | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
calexandre
calexandreOP6mo ago
Will try, thank you!
Solution
calexandre
calexandre6mo ago
Okay, so trying what you said I achived it by calling $this->addError directly on the livewire class
calexandre
calexandreOP6mo ago
Thank you!
Want results from more Discord servers?
Add your server