You can compare the value of one field to another to dynamically change the validation of a field.
In this example, each input field checks what was picked from the radio group, then if the input is empty, returns invalid.
The phone number and email input boxes each have validation functions that look like this:
Phone Validation Function
Email Validation Function
Pick an option from the radio buttons then press submit. The input fields become "required" based on what you choose.