Expand my Community achievements bar.

Unnamed fields in a form: how to reference them in a dataset

Avatar

Level 1

Hi all,

I am trying to programmatically fill out an XFA form. The form contains a table in which rows can be added dynamically. This is what the relevant template segment (in a simplified form) looks like:

...

               <subform name="page6">

                     <subform name="headerSF">

                          <field name="TextField13">

                          <field name="TextField15">

                          <field name="TextField14">

                     <subform name="Table1">

                          <subform name="HeaderRow">

                               <field>

                          <subform name="Row1">

                               <subform name="buttons">

                                    <field name="addRow">

                                    <field name="DeleteRow">

                                    <field name="moveUp">

                                    <field name="moveDown">

                               <field>

                               <field name="quantity">

                               <field name="unitPrice">

                               <field>

                               <field>

                               <field>

                               <field>

                               <field>

                               <field>

                               <field>

                               <field>

                               <field>

As you can see, quantity and unitPrice are named, but the other fields in the table row are not.

So, I can easily specify the quantity and unitPrice via the following dataset XML:

<page6>

          <headerSF>

                    <TextField13/>

                    <TextField15/>

                    <TextField14/>

          </headerSF>

          <Table1>

                    <HeaderRow xfa:dataNode="dataGroup"/>

                    <Row1>

                              <buttons xfa:dataNode="dataGroup"/>

                              <quantity>12</quantity>

                              <unitPrice>3242.11</unitPrice>

                    </Row1>

but how do I specify the other, unnamed, fields for the table row?

Thanks a lot in advance.

-- DC Dweller


1 Reply

Avatar

Level 10

Hi,

the data of the unnamed fields won't get saved in the data DOM, because of the missing namings.

You can easily check how the data DOM looks like.

Add a text field with this script in it's calculate event to show the data DOM's structure.

var dump = xfa.data.saveXML("pretty");

this.rawValue = dump;

You'll see something like:

<?xml version="1.0" encoding="UTF-8"?>

<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">

   <Form1>

      <Table1>

         <Row1>

            <quantity/>

            <unitPrice/>

         </Row1>

      </Table1>

   </Form1>

</xfa:data>