Cannot get custom Validation Message for Select Component to work
I have the following Select component with the
required
validation.
It does validate correctly, but the custom validation doesn't show. Here is what it shows. I have the same issue with other components also not showing custom validation messages.
9 Replies
Am I missing anything? I tried to use
native()
as well and doesn't work with that as well.are you using a statePath?
provide more info or the whole code..
Just tested with the demo, so it's not a bug in Filament:

ok, so, I am using Filament Forms as standalone and not within the Admin Panel. I have setup all the form elements inside the
form(Form $form)
method with the necessary validations for each form element. On form submission, when I call the $this->validate()
, it doesn't seem to use the custom message I have setup for each element, but does the normal validation message configured on the lang file.
I don't have a statePath
setup$this->form->getState()
actuallyShare your code. There shouldn't be a
$this->validate()
Did you follow the docs? They don't mention
validate()
anywhere:
https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-componentSolution
$this->form->getState()
will validate the formYes, I followed the documentation. how do I go about validating the form on form submission? if I don't use
$this->validate()
it doesn't seem to validate.
ah ok, let me check that
ok, now that works, thank you very much.