Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Empty SubForms submitting empty fields/records

Avatar

Level 1

I have a document containing three pages.  The first page contains two checkboxes that will display the hidden subforms I have in document, if needed.  If the user does not need to access the subforms, check boxes are set to off and the subforms will not display.

How do I prevent from the empty subforms from export to data.xml file when submitting file via email submit.

I would like to know how to script or change a setting that will prevent the empty subforms from submitting when document is submitted.

8 Replies

Avatar

Level 10

If you donot want a field value to appear in the data.xml then you need to set the Default Binding to "None" in the binding tab of the field properties.

Thanks

Srini

Avatar

Level 1

That worked! Thanks.

Is there a way to set the page instead of the individual fields to None. I tried clicking on the top level of page and set it to none but the empty fields within that page still exported to my data.xml file. So I clicked on each field individually and set the binding to None.

>>> Srini Dhulipalla <forums@adobe.com> 4/22/2010 10:31 AM >>>

If you donot want a field value to appear in the data.xml then you need to set the Default Binding to "None" in the binding tab of the field properties.

Thanks

Srini

Avatar

Level 10

The binding happens at the Field level and not at the form level. So you need to set the Default binding to None for each field.

Thanks

Srini

Avatar

Level 1

Jumped the gun too fast... Now when testing form, if I enter data in the subform, since the fields are set to None for binding, now nothing exports to my data.xml file. Any ideas why?

>>> Srini Dhulipalla <forums@adobe.com> 4/22/2010 10:31 AM >>>

If you donot want a field value to appear in the data.xml then you need to set the Default Binding to "None" in the binding tab of the field properties.

Thanks

Srini

Avatar

Level 10

Incase if you want to delete the tags conditionally you need to write code before Submit/ export the data..

You need to use xfa.datasets.data.nodes collection which is nothing but the XML that is generated from the form. You need to loop thru the collection and identify which tag is not needed in the XML and remove it.

For Example:

     var nodeRemove = xfa.datasets.data.nodes.item(0).nodes.item(1);

     xfa.datasets.data.nodes.item(0).nodes.remove(nodeRemove); //Where nodeRemove is the node that you do not want to appear in the data XML.

Another Example to loop thru the nodes in Data..

//Remove the userImageURL tag from the Output XML
for(i=0;i<xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.length;i++){
     var strTagName = xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.item(i).name;
     if(strTagName == "userImageURL"){
          nodeRemove = xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.item(i);
          xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.remove(nodeRemove); 
     }
}

Hope this gives an idea..

Thanks

Srini

Avatar

Level 1

I am not a programmer but will try and figure this out... in your code does it look for empty tags or is there additional coding required to first look for empty tags and then remove the empty tags with the code you provided as an example.

>>> Srini Dhulipalla <forums@adobe.com> 4/22/2010 12:43 PM >>>

Incase if you want to delete the tags conditionally you need to write code before Submit/ export the data..

You need to use xfa.datasets.data.nodes collection which is nothing but the XML that is generated from the form. You need to loop thru the collection and identify which tag is not needed in the XML and remove it.

For Example:

var nodeRemove = xfa.datasets.data.nodes.item(0).nodes.item(1); xfa.datasets.data.nodes.item(0).nodes.remove(nodeRemove); //Where nodeRemove is the node that you do not want to appear in the data XML.

Another Example to loop thru the nodes in Data..

//Remove the userImageURL tag from the Output XML

for(i=0;i<xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.length;i++){

var strTagName = xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.item(i).name;

if(strTagName == "userImageURL"){

nodeRemove = xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.item(i);

xfa.datasets.data.nodes.item(0).nodes.item(0).nodes.remove(nodeRemove);

}

}

Hope this gives an idea..

Thanks

Srini

Avatar

Level 10

You need write code to first check for the emptyness before you delete the data nodes in XML.

I only provided you the sample to loop thru the collection and to delete it.

Thanks

Srini

Avatar

Level 1

I think I know what the problem is. I was just having this same issue and i found that if I import a Word Doc into Adobe Acrobat as a form and then use the fields that are automatically generated then when the form is filled in and e-mail submitted the xml file is empty. If I delete the automatically generated fields and re-create them with the palette tool then when that form is filled and submitted the contents are delivered in the xml file.