How to populate the same XML data in multiple fields in AEM Forms?
By design, the XML data tag can only be mapped to one field in the form. But still, if you bind it with multiple fields then at runtime it fills the field that comes first in occurrence.
The Global Binding is also not of much use here. So the only option left is JavaScript.
Through JavaScript, we can assign the raw Value of multiple fields together.
var rowNodes = Table1.disqualifiedIndvDetails.instanceManager.count;
for (var nNodeCount = 0; nNodeCount < rowNodes ; nNodeCount ++)
{
page2.Table2.disqualifiedIndvDetails.instanceManager.addInstance();
page3.Table3.disqualifiedIndvDetails.instanceManager.addInstance();
xfa.resolveNode("page2.Table2.disqualifiedIndvDetails["+nNodeCount+"].name").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].name").rawValue
xfa.resolveNode("page2.Table2.disqualifiedIndvDetails["+nNodeCount+"].disReason").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].disReason").rawValue
xfa.resolveNode("page2.Table2.disqualifiedIndvDetails["+nNodeCount+"].numMonths").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].numMonths").rawValue
xfa.resolveNode("page3.Table3.disqualifiedIndvDetails["+nNodeCount+"].name").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].name").rawValue
xfa.resolveNode("page3.Table3.disqualifiedIndvDetails["+nNodeCount+"].disReason").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].disReason").rawValue
xfa.resolveNode("page3.Table3.disqualifiedIndvDetails["+nNodeCount+"].numMonths").rawValue = xfa.resolveNode("Table1.disqualifiedIndvDetails["+nNodeCount+"].numMonths").rawValue
}
Source File: https://www.dropbox.com/s/1s0i3hoqzpnycsz/MultipleData.zip?dl=0
No comments:
Post a Comment