requiredWithoutAll() validation being ignored
I'm using a Form Builder form in a regular Livewire component. Simple validations on the fields (required, email) work fine. But I have three fields with a requiredWithoutAll rule for the other two. So field1 has . These rules get ignored. No error messages and nothing in the logs. Just goes along and submits without any issue. I can put a secondary validation in the Livewire component itself which does catch them but it (a) makes for an ugly UX difference and (b) for some reason, custom error messages aren't working there. Any ideas why these rules aren't getting triggered?
6 Replies
I have the same issue, but with
requiredWithout()
I ended up having to put a specific validation for my three fields in the Livewire component method that the form uses for wire:submit. It works fine but I really don't like the UI switch. Still no clue why it doesn't work as documented but I couldn't spend any more time chasing it down.
I know this is an old message but you need to put the requiredWithoutAll rule on all 3 fields, not just one
Maybe it wasn't clear in my original message but it was on all three. ("I have three fields with a requiredWithoutAll rule for the other two.") But I only gave the example for field1. I had the requirement on each of them specifying the other two as the arguments. The end result I wanted is for at least one of them to be filled.
It's working okay with it on the component as described above but I'd love to have it working natively so if the way I had it was still wrong somehow, I'd appreciate any more information to get it all within the Filament form definition.
Can you share the code of the fields?
It’s possible that depending on the field types, one of them is always set to a value. But can’t be sure without seeing the relevant code.
Here's the section involved. In short, I just want to make sure at least one phone number has a value but it lets me submit with them all empty.
If I put this in my
save()
method in the Livewire Component itself, I get validation when they hit the submit button.