Remove a subform permanently

Geckoz100

10-05-2016

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Magus069

MVP

10-05-2016

Hi Geckoz...

it could be possible finding how to delete a subform, but if your goal is just to remove required fields you can either remove the required property from the field(s) or...

You should start removing any required field within any Adobe forms and start using your own validation which is much more convenient for forms... here is a thread in which I provide a form with good functionalities to put within a form.

Validation / Reset Functions, easy to manipulate and to change Forms!!!!

Especially the Validation function is very good for these kinda forms, it will only validate all fields which are visible to the user, if you don't want to validate all fields to be 'mandatory', you can add the names of those fields within the exception array.

I hope this will help you for your form!