Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to NOT send some form data when form is submitted

Avatar

Former Community Member

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

Avatar

Correct answer by
Former Community Member

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

Avatar

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.

Avatar

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.

Avatar

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

Avatar

Former Community Member

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

Avatar

Correct answer by
Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----