Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to NOT send some form data when form is submitted

WRMA_Sam
Level 2
Level 2

Hi,

I created a PDF form with some radiobuttons in group and checkboxes. When I get the form data values, like using Email Submission Button to send form data in XML or using Merge data files into spreadsheet, I will see the data values for those radiobuttons and checkboxes.

What I want here is to get only the data values for some controls like radiobuttons, but not other controls like checkboxes, in the XML or Excel spreadsheet after submitting the form. I just know how to hide the controls in the form, but I do need the checkboxes visible and active on the form.

Is there a way to hide or not to send some form data when form data is submitted?

Thanks

Sam

1 Accepted Solution
WRMA_Sam
Correct answer by
Level 2
Level 2

Hi Kyle,

This is exactly what I want! After I select No data binding, the field is in the form and active, but when submit in XML or merge it to spreadsheet, the field is gone.

Forgive me if I did not make my self clear in my question. You answer is right to the point.

Thanks so much!

Sam

View solution in original post

5 Replies
Josh_Geurian
Level 4
Level 4

It is my understanding that is just not possible. Hidding the fields does not remove them from the XML file. This would be akin to hiding a column in Excel and then not exporting it: it isn't going to happen and having the fields visible and active on the form makes it even worse. I have tried this before in the past and unless I am wrong, I never got it to not include the fields in the XML. I tried hiding them, setting the field presence to inactive and even just removing the instance, but that does not change the backend XML which is really all that a XFA form really is. My advice: just hide the columns in the Excel file you do not want.

radzmar
Level 10
Level 10

Courious, i saw the same question this week in a german forum.

Well, it's possible to transform the data you want to submit before you submit.

Therefore you have to manipulate the Data DOM, which can be tricky.

The simplest method is to use the remove() method, to delete all unwanted nodes from the data.

Here's a sample (sorry contains some german remarks).

In short: It creates a backup of the Data DOM, deletes a unwanted subform named "TF2" from the data, submits data as mail and then resores the data from the backup.

//Variablen

var dataDOM = xfa.datasets.data, //Data DOM

backupXML = dataDOM.saveXML(), //Backup des kompletten Data DOM

backupData = xfa.datasets.createNode("dataGroup", "backupDOM"), //Datennode für Backup erstellen

backupNode = xfa.datasets.nodes.namedItem("backupDOM"); //Temporäres Data DOM suchen

//Backup mit Daten befüllen

backupData.loadXML(backupXML);

//Temporäres Data DOM unter xfa.datasets anlegen

//Zuerst evtl. vorhandene Backups entfernen ...

while (backupNode !== null) {

xfa.datasets.nodes.remove(backupNode);

backupNode = xfa.datasets.nodes.namedItem("backupDOM");

}

// ... dann Backup auslagern.

xfa.datasets.nodes.append(backupData);

//Data DOM für Export von ungewünschter Node bereinigen

xfa.datasets.data.Formular1.Seite.nodes.remove(xfa.datasets.data.Formular1.Seite.nodes.namedItem("TF2"));

//Data DOM exportieren z.B. per Mail-Anhang

var cEmailURL = "mailto:user@domain.org?subject=Meine Daten&body=Hallo, hier kommen meine Daten.";

event.target.submitForm({cURL: encodeURI(cEmailURL), cSubmitAs:"XML", cCharSet:"utf-8"});

//Data DOM aus Backup wiederherstellen

xfa.datasets.data.loadXML(xfa.datasets.nodes.namedItem("backupDOM").saveXML(), true, true);

A more advanced method would be the usage of a XSLT stylesheet. But this has to be customized for every form.

Hope this helps.

dcidev
Level 8
Level 8

Maybe I'm oversimplifying or not understanding the question but can't you just remove the data bindings from the checkboxes?

1) Select the field (your checkbox)

2) Under the Object palette select the Binding tab

3) For Data Binding select No data binding

Kyle

WRMA_Sam
Level 2
Level 2

Radzmar,

Thanks for the reply. Hmm, it seems very interesting. Here is my situation:

I have a form with multiple pages (subforms). Each page contains a content table. A content table contains some rows. Each row contains a radiobutton group and a checkbox. Something like:

...

formPage[0].contentTable.questionRow[0].formAnswer.SKIPCheckbox_01_01 (Checkbox name)

formPage[0].contentTable.questionRow[1].formAnswer.SKIPCheckbox_01_02 (Checkbox name)

...

The checkbox name changes with the page and table row.

I want to remove all the checkbox from the all pages in all the table rows.

In your example, I see that the following line removes the item (subform."TF2").

xfa.datasets.data.Formular1.Seite.nodes.remove(xfa.datasets.data.Formular1.Seite.nodes.namedItem("TF2"));

However, I am not quite sure how I can remove the checkbox in the Data DOM. Is it like the following?

xfa.datasets.data.formPage[0].contentTable.questionRow[0].formAnswer.nodes.remove(xfa.datasets.data.formPage[0].contentTable.questionRow[0].formAnswer.nodes.namedItem("SKIPCheckbox_01_01"));

And I don't need to send the data in XML. I just need save the modified Data DOM so user can process it without the checkbox value. Or when it is merged to spreadsheet, the checkbox value won't show.

Do you think, in my case, which way is better: remove or style sheet?

Thanks

Sam

WRMA_Sam
Correct answer by
Level 2
Level 2

Hi Kyle,

This is exactly what I want! After I select No data binding, the field is in the form and active, but when submit in XML or merge it to spreadsheet, the field is gone.

Forgive me if I did not make my self clear in my question. You answer is right to the point.

Thanks so much!

Sam

View solution in original post