XFA - Cannot print fields with no names

- it was not possible to print pdf file in issue #13500.
This commit is contained in:
Calixte Denizet 2021-07-14 17:38:32 +02:00
parent a17bd13023
commit 019699acfb
2 changed files with 13 additions and 10 deletions

View File

@ -478,10 +478,10 @@ class Binder {
if (dataChildren.length > 0) { if (dataChildren.length > 0) {
this._bindOccurrences(child, [dataChildren[0]], null); this._bindOccurrences(child, [dataChildren[0]], null);
} else if (this.emptyMerge) { } else if (this.emptyMerge) {
const dataChild = new XmlObject( const dataChild = (child[$data] = new XmlObject(
dataNode[$namespaceId], dataNode[$namespaceId],
child.name || "root" child.name || "root"
); ));
dataNode[$appendChild](dataChild); dataNode[$appendChild](dataChild);
this._bindElement(child, dataChild); this._bindElement(child, dataChild);
} }
@ -602,7 +602,10 @@ class Binder {
if (!match) { if (!match) {
// We're in matchTemplate mode so create a node in data to reflect // We're in matchTemplate mode so create a node in data to reflect
// what we've in template. // what we've in template.
match = new XmlObject(dataNode[$namespaceId], child.name); match = child[$data] = new XmlObject(
dataNode[$namespaceId],
child.name
);
if (this.emptyMerge) { if (this.emptyMerge) {
match[$consumed] = true; match[$consumed] = true;
} }

View File

@ -1150,11 +1150,11 @@ class CheckButton extends XFAObject {
groupId = container[$uid]; groupId = container[$uid];
type = "radio"; type = "radio";
className = "xfaRadio"; className = "xfaRadio";
dataId = container[$data] && container[$data][$uid]; dataId = (container[$data] && container[$data][$uid]) || container[$uid];
} else { } else {
type = "checkbox"; type = "checkbox";
className = "xfaCheckbox"; className = "xfaCheckbox";
dataId = field[$data] && field[$data][$uid]; dataId = (field[$data] && field[$data][$uid]) || field[$uid];
} }
const input = { const input = {
@ -1256,7 +1256,7 @@ class ChoiceList extends XFAObject {
const selectAttributes = { const selectAttributes = {
class: ["xfaSelect"], class: ["xfaSelect"],
fieldId: field[$uid], fieldId: field[$uid],
dataId: field[$data] && field[$data][$uid], dataId: (field[$data] && field[$data][$uid]) || field[$uid],
style, style,
}; };
@ -1493,7 +1493,7 @@ class DateTimeEdit extends XFAObject {
attributes: { attributes: {
type: "text", type: "text",
fieldId: field[$uid], fieldId: field[$uid],
dataId: field[$data] && field[$data][$uid], dataId: (field[$data] && field[$data][$uid]) || field[$uid],
class: ["xfaTextfield"], class: ["xfaTextfield"],
style, style,
}, },
@ -3508,7 +3508,7 @@ class NumericEdit extends XFAObject {
attributes: { attributes: {
type: "text", type: "text",
fieldId: field[$uid], fieldId: field[$uid],
dataId: field[$data] && field[$data][$uid], dataId: (field[$data] && field[$data][$uid]) || field[$uid],
class: ["xfaTextfield"], class: ["xfaTextfield"],
style, style,
}, },
@ -5397,7 +5397,7 @@ class TextEdit extends XFAObject {
html = { html = {
name: "textarea", name: "textarea",
attributes: { attributes: {
dataId: field[$data] && field[$data][$uid], dataId: (field[$data] && field[$data][$uid]) || field[$uid],
fieldId: field[$uid], fieldId: field[$uid],
class: ["xfaTextfield"], class: ["xfaTextfield"],
style, style,
@ -5408,7 +5408,7 @@ class TextEdit extends XFAObject {
name: "input", name: "input",
attributes: { attributes: {
type: "text", type: "text",
dataId: field[$data] && field[$data][$uid], dataId: (field[$data] && field[$data][$uid]) || field[$uid],
fieldId: field[$uid], fieldId: field[$uid],
class: ["xfaTextfield"], class: ["xfaTextfield"],
style, style,