Validate a field inside a modal
I'd like to know if there is a way to validate a field inside a modal window. (which is of course called from an action).
I have a
Select
field that has to be filled in, before executing the action. How can I achieve this?
This is my code so far:
10 Replies
So an empty select doesn't trigger a validation error in this example?
No, that is right. Maybe because it is inside a modal / action?
I tried e.g. `$livewire->validateOnly('') but that didn't work either.
Kinda looks like a bug to me... I'll see if I can replicate
I'm not 100% sure, but can you try without the
->searchable()
?Hm... that doesn't make any difference, unfortunately.
It's strange, I cannot replicate the issue. It validates for me in the context of a page action.
This Action is in a Form. Did you try that also?
Yeah, seems to work too with a form component action
I'd say feel free to open an issue on Github, if you can provide a minimal example repository to reproduce the issue. It could be a bug for your specific use-case.
May I see your working code inside a Form Builder? I could have missed something?
I see. The difference is that I have an Action inside an Action. Maybe that is the issue.