I have a travel approval form that has two sections, Domestic and Foreign. I set up the Domestic portion in one subform, the Foreign in another. At the top I have a radio for Domestic/Foreign, so the user clicks one and the unused section is supposed to disappear. The reason I want it to disappear and not just be hidden is because both sections contain required fields, so if I just hide the unused one, It still says there are incomplete fields when submitting. I have tried using the setInstances and removeInstance methods, with different problems, but basically the "removed" section keeps coming back when after I save and reopen the document with error messages such as "setInstances cannot be called because doing so would violate this document's permissions settings". I currently have the following script in the radio button:
if (this.rawValue == "1") { // DOMESTIC
form1.Foreign.occur.min = "0";
form1._Foreign.setInstances(0);
}
if (this.rawValue == "2") { // FOREIGN
form1.Domestic.occur.min = "0";
form1._Domestic.setInstances(0);
}
I also tried setting the sections to presence "inactive", but upon clicking a Submit button I get a message saying that there are still incomplete fields, which I'm assuming are the required fields in the inactive section.
I greatly appreciate any help.