Hello -
The reason you are getting the error is because the system is also validating the "hidden" group (Foreign) even though it's hidden. Same thing would happen if Foreign is visible and all fields are completed, but the Domestic group is hidden. It will still attempt to validate the Domestic fields unless you wrote a script to "exclude" them.
One way to resolve the issue is by setting up the groups as "instances" and then add & remove the instances via the radio button. So initially, both instances will be set to 0 when the radio button is unchecked, then choosing one or the other radio button will set the applicable instance to 1 and the other to 0. For example, checking Domestic will set it's instance to 1 and set the Foreign instance group to 0, effectively removing it from the page. By doing this, you are removing the instance from the form completely (vs changing its presence to hidden/inactive) thus it wouldn't be validated.
Try the script below. NOTE: Please ensure all of the Domestic and Foreign content is placed in separate subform groups (if you haven't done so already), then ensure "Repeat Subform for Each Data Item" is checked for each subform group under the Binding tab. Also, ensure the Max box is checked and set to "1" for each group since you aren't trying to "add" multiple instances, but simply controlling the single existence of each instance. Also, ensure the export values of the radio buttons is set to 1 for Domestic, and 2 for Foreign.
***********************************
Place script on Click event of the main radio button group (NOT the individual radio button)
// Set the instances of each of the subforms
// Note "_" is shorthand for instanceManager
if (this.rawValue == 1) {//Domestic radio button is checked
_Domestic.setInstances(1);//note: ensure correct name and path of Subform group
_Foreign.setInstances(0);//note: ensure correct name and path of Subform group
}
else if (this.rawValue == 2) {//Foreign radio button is checked
_Domestic.setInstances(0);
_Foreign.setInstances(1);
}
else {//radio button field is reset...neither Domestic or Foreign is checked
_Domestic.setInstances(0);
_Foreign.setInstances(0);
}