views:

340

answers:

1

Heres a simple form to help illustrate the issue. This is not the complete code for a form since it was way too long (or bloated rather) to post. So if you open Adobe LiveCycle and create a blank document, insert the following as the main content.

Then save it as a pdf. If you open the pdf and save it you'll see the subform went from showing up once to showing up twice. Does anyone see why this code/markup would cause another instance of the form to be created when it has been saved?

I'm not that familiar enough with LiveCycle to understand all of the generated syntax, but it doesn't seem like anything should be doing this. I thought that maybe the buttons responsible for adding another instance of the form were firing without me knowing, but that doesn't seem to be the case as removing the buttons entirely doesn't resolve the issue.

       <subform y="1498.455mm" w="190.5mm" minH="9.234mm" layout="tb" name="ScheduleOne">
          <subform w="100.783mm" minH="6.349mm" layout="tb" name="Form">
             <subform y="47.164mm" w="190.5mm" minH="6.349mm" layout="tb" name="Form">
                <draw name="Text17" minH="6.349mm" w="190.455mm">
                   <ui>
                      <textEdit>
                         <border>
                            <?templateDesigner StyleID aped1?>
                            <edge presence="hidden"/>
                            <edge presence="hidden"/>
                            <edge/>
                            <edge presence="hidden"/>
                         </border>
                         <margin/>
                      </textEdit>
                   </ui>
                   <value>
                      <text>subForm</text>
                   </value>
                   <font typeface="Times New Roman" size="11pt"/>
                   <margin topInset="0mm" bottomInset="0mm"  leftInset="0mm" rightInset="0mm"/>
                   <para vAlign="middle" marginLeft="0pt" hAlign="center"/>
                   <traversal>
                      <traverse ref="ButtonGroup1[0].Button1[0]"/>
                   </traversal>
                </draw>
                <occur max="-1"/>
                <keep intact="contentArea"/>
                <?templateDesigner expand 1?></subform>
             <subform name="ButtonGroup1" layout="lr-tb" relevant="- print" minH="6.017mm" w="190.5mm">
                <keep intact="contentArea" previous="contentArea"/>
                <margin bottomInset="1mm" leftInset="147.828mm" topInset="1mm"/>
                <traversal>
                   <traverse operation="first" ref="Button1[0]"/>
                </traversal>
                <field relevant="-print" h="6mm" name="Button1" w="20mm">
                   <border hand="right">
                      <edge stroke="raised"/>
                      <fill>
                         <color value="212,208,200"/>
                      </fill>
                      <?templateDesigner StyleID apbx2?>
                      <?templateDesigner StyleID apbx2?>
                      <?templateDesigner StyleID apbx2?>
                      <?templateDesigner StyleID apbx2?>
                      <?templateDesigner StyleID apbx2?></border>
                   <caption>
                      <font typeface="Arial" size="9pt"/>
                      <para hAlign="center" vAlign="middle"/>
                      <value>
                         <text>Remove</text>
                      </value>
                   </caption>
                   <font typeface="Myriad Pro"/>
                   <ui>
                      <button highlight="inverted"/>
                   </ui>
                   <bind match="none"/>
                   <event activity="click" name="event__click">
                      <script contentType="application/x-javascript">

var inst = Form.instanceManager;

if (inst.count &gt; 1) {
     inst.removeInstance(inst.count - 1); } else {
    xfa.host.messageBox("The minimum allowable number of fields is 1. You cannot remove any more fields.", "Warning", 3); }</script>
                   </event>
                   <traversal>
                      <traverse ref="Button1[1]"/>
                   </traversal>
                </field>
                <subform h="1.27mm" name="Subform1" w="2.54mm"/>
                <field relevant="-print" h="6mm" name="Button1" w="20mm">
                   <border hand="right">
                      <edge stroke="raised"/>
                      <fill>
                         <color value="212,208,200"/>
                      </fill>
                      <?templateDesigner StyleID apbx2?></border>
                   <caption>
                      <font typeface="Arial" size="9pt"/>
                      <para hAlign="center" vAlign="middle"/>
                      <value>
                         <text>Add More</text>
                      </value>
                   </caption>
                   <font typeface="Myriad Pro"/>
                   <margin leftInset="0mm"/>
                   <ui>
                      <button highlight="inverted"/>
                   </ui>
                   <bind match="none"/>
                   <event activity="click" name="event__click">
                      <script contentType="application/x-javascript">
Form.instanceManager.addInstance(1);</script>
                   </event>
                   <traversal>
                      <traverse ref="Text16[0]"/>
                   </traversal>
                </field>
                <?templateDesigner expand 0?></subform>
             <draw name="Text16" w="190.455mm">
                <ui>
                   <textEdit/>
                </ui>
                <value>
                   <text>MainForm</text>
                </value>
                <font size="9pt" typeface="Arial"/>
                <margin topInset="0mm" bottomInset="0mm" leftInset="0mm" rightInset="0mm"/>
                <traversal>
                   <traverse ref="ButtonGroup2[0].Button1[0]"/>
                </traversal>
                <para hAlign="center"/>
             </draw>
             <occur max="-1"/>
             <keep intact="contentArea"/>
             <?templateDesigner expand 0?></subform>
          <subform name="ButtonGroup2" layout="lr-tb" relevant="- print" minH="6.017mm" w="190.5mm">
             <keep intact="contentArea" previous="contentArea"/>
             <margin bottomInset="1mm" leftInset="147.828mm"  topInset="1mm"/>
             <traversal>
                <traverse operation="first" ref="Button1[0]"/>
             </traversal>
             <field relevant="-print" h="6mm" name="Button1" w="20mm">
                <border hand="right">
                   <edge stroke="raised"/>
                   <fill>
                      <color value="212,208,200"/>
                   </fill>
                   <?templateDesigner StyleID apbx2?>
                   <?templateDesigner StyleID apbx2?>
                   <?templateDesigner StyleID apbx2?>
                   <?templateDesigner StyleID apbx2?>
                   <?templateDesigner StyleID apbx2?></border>
                <caption>
                   <font typeface="Arial" size="9pt"/>
                   <para hAlign="center" vAlign="middle"/>
                   <value>
                      <text>Remove</text>
                   </value>
                </caption>
                <font typeface="Myriad Pro"/>
                <ui>
                   <button highlight="inverted"/>
                </ui>
                <bind match="none"/>
                <event activity="click" name="event__click">
                   <script contentType="application/x-javascript">

var inst = Form.instanceManager;

if (inst.count &gt; 1) {
     inst.removeInstance(inst.count - 1); } else {
    xfa.host.messageBox("The minimum allowable number of fields is 1. You cannot remove any more fields.", "Warning", 3); }</script>
                </event>
                <traversal>
                   <traverse ref="Button1[1]"/>
                </traversal>
             </field>
             <subform h="1.27mm" name="Subform1" w="2.54mm"/>
             <field relevant="-print" h="6mm" name="Button1" w="20mm">
                <border hand="right">
                   <edge stroke="raised"/>
                   <fill>
                      <color value="212,208,200"/>
                   </fill>
                   <?templateDesigner StyleID apbx2?></border>
                <caption>
                   <font typeface="Arial" size="9pt"/>
                   <para hAlign="center" vAlign="middle"/>
                   <value>
                      <text>Add More</text>
                   </value>
                </caption>
                <font typeface="Myriad Pro"/>
                <margin leftInset="0mm"/>
                <ui>
                   <button highlight="inverted"/>
                </ui>
                <bind match="none"/>
                <event activity="click" name="event__click">
                   <script contentType="application/x-javascript">
Form.instanceManager.addInstance(1);</script>
                </event>
             </field>
             <?templateDesigner expand 0?></subform>
          <traversal>
             <traverse operation="first" ref="Form[0].Form[0].Text17 [0]"/>
          </traversal>
          <?templateDesigner expand 1?></subform>
A: 

So this problem was "fixed" by removing an empty subform. No one has any idea why, but removing the subform and giving all the elements unique names keeps the elements from duplicating.

It's been reported as a bug to Adobe.

Brandon