Validation: At least one of n fields has to be notEmpty
Validation: At least one of n fields has to be notEmpty
goetzi
Posts: 3Questions: 2Answers: 0
Hi!
I have two fields, "email" and "phone". When saving an entry, at least one of both fields has to be filled in. How can I validate this?
->validator( 'Validate::notEmpty' )
doesn't help me here
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You'd need a custom validator. The second parameter contains the data for the whole row so you can check to see if a valid is supplied for at least one.
Allan
Thank you!
This custom validator did the trick: