Validation: Check if Supplier has Contact and the Contact has a Phone or Mobile No


I want to validate Supplier by checking if Supplier has at least 1 contact and that the contact has at least 1 phone no or mobile no (is_primary_phone or is_primary_mobile).

Remember Contact field in Supplier is of html type. Also making phone_no or mobile_no field mandatory in Contact does not allow Saving.

How do I go about this. Any help is appreciated.