Validating fields based on the value of another field