Help with JS web form

I am looking for some help with a web form using JavaScript for validation. This is a section of a larger form that was created in a cms. (hence the extra code padding)

The form has a question that asks the user if they have a Social Security Number. (SocialSecurity field) It has two radio buttons, one yes and one no. IF the user answers yes, then another field (SSN) becomes visible. Otherwise, it stays hidden. This part is actually working. (the show/hide of the SSN field)

The JS needs to do two things. IF the user answers yes, then the SSN field becomes required, and must validate that it has 9 integers. BUT, if the user answers no, then SSN field, which will stay hidden must no longer be required.

What I am having difficulty with, is getting the SSN to be required only if the user answers yes, and validate it correctly under that circumstance.

Here is the code:
https://jsfiddle.net/Ladybug333/acrd4w0n/11/#&togetherjs=KBFMVaj2wS

Hi,

I used a variable named shouldValidateSSN to get the conditional validation to work.

Here is the code:
https://jsfiddle.net/svqo8hk5/2/