I have a requirement in a project that I feel is a bad idea.
We have a form with the usual fields, name, address, email phone number, etc. My requirement is to make email required based on the state field. For example, if state is New Jersey, then email should be required.
I feel in my bones that it is wrong to set a field to required as a form is being filled out. It seems wrong, but I can't find anything online that shows that this violates some kind of standard or design principle.
My idea is to hide the section of the form containing email and when the state field changes, show the section, and if the state is New Jersey, make the email field required. By hiding the section at the beginning the user has no idea the email field exists much less if it is required. Then when the section is shown, the email field will be required or not, but the user doesn't have any preconceived notion that is being changed. I feel this is a better solution.
My question is, is it wrong to dynamically set a field to required? If so, is my solution better/good?
Any feedback would be appreciated.