Making a field required dynamically

Making a field required dynamically

Hi-

This is what I'm trying to accomplish:

I have Field 1, a radio button, with answers of Yes or No.

If the user clicks Yes, I want Field 2 to display, and I want Field 2 to be required...but only if Field 2 is displayed.

Right now, here's what happens:

The form loads with Field 1 showing, Field 2 hidden.

If the user clicks Yes for Field 1, Field 2 appears.

But the problem is, if the user clicks No for Field 1, Field 2 doesn't appear; and when they click Submit, they get an error that says "Field 2 is required". This is bad because they can't even see Field 2!

How can I get the form to work so that if Field 2 never gets displayed, it doesn't give the user an error when they Submit the form?