Form with C union-like structure
I need to create a form which resembles union. Basically I want to create a form, part of which depends on one particular field. For each value of that field there are other fields that become needed once their value is set. The number of fields may vary greatly, so the form may become very long for one value and very short for another. I want to fit this into general form structure of sections, groups and fields.
The idea I came up with is to split the form into sections, request switching input in one section and corresponding fields in the next, but the switching section would be too small. Another idea is to put switching field and its fields into group of fields and dynamically change the fields depending on switching field but I don't want jumping content.
What is the best solution in this case, so that user doesn't face with jumping content or too short section?
EDIT: Example of such an input would be a country. Depending on a country user needs to enter different fields to identify his organization.
EDIT 2: By section I mean step.