I have form, when form submit the i want validate the form as following condition.
1 . Phone no. and email field must not empty
2. Either phone no. or email entered then form will submitted.
I have write some code as per doc.
$validator
->notEmpty('email', __('Required email is empty.'), function ($context) {
return !$context['data']['email'];
});
$validator
->notEmpty('phone_no', __('Required phone_no is empty.'), function ($context) {
return !$context['data']['phone_no'];
});
$validator->notEmpty('phone_no', __("Required phone_no or email is empty."), function ($context) {
return !$context['data']['phone_no'] && !$context['data']['email'];
});
Let me know whats wrong step in this validation.