How to validate a single field when using a form action?
Is there a way to validate a single field inside a form action?
I tried to validate the field
keywords
, but it didn't work:
15 Replies
It still didn't work
Are you using admin panel?
I am using it inside a custom Livewire component, like this: https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component
inside
Like this:
ok, and where is the form?
are you using statePath?
you can also use a suffixAction
https://filamentphp.com/docs/3.x/forms/actions#adding-an-affix-action-to-a-field
ok, and where is the form?Inside an action of a
table
function
are you using statePath?No.
you can also use a suffixActionI tried, but I need to use an icon in order for the suffix action to work. I just want a button with the label "Submit". Also I think there should be a more suitable way to validate specified fields. What if someone wants a min-form inside the form?
hum.. If you have an advanced form, I think you can use a modal content/custom view to render a livewire component
adding a form to a Livewire component class
https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#adding-the-form
this seems to be too much configuration for having a button that validates a single input. I will open tomorrow a feature request/bug report on Github
Thank you for your help!
why bug?
Because there is a method
validateOnly
inside InteractsWithForm
and it doesn't seem to work.
Anyway, I have to spend more time in order to be sure if this is a bug, a new feature or if it's not documented enough.ok
validateOnly
is a livewire featureI'll check on this
Actually, I just fixed it. All I had to do was
I solved my issue.
Thank you @leandro_ferreira for your help!