<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Instantiating Subforms at Runtime</title>
	<atom:link href="http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/feed/" rel="self" type="application/rss+xml" />
	<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/</link>
	<description>Building intelligent forms using Adobe LiveCycle Designer</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:32:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: R.L.E</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4896</link>
		<dc:creator>R.L.E</dc:creator>
		<pubDate>Fri, 26 Nov 2010 11:44:21 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4896</guid>
		<description>My form has a constant set of dynamic and static textFields for page 1 and 2, pg.2 having a header block that will need to be called to repeat to the top of a variable number of subsequent pages.

I need to create for the 3rd (+ pages) a set of data input fields that will create repeatable new subForm instances to the body of the page below, insert sentences/paragraphs of variable length from a dataBase (based on item codes) into each new instance and clear itself with each submission (button or enter key).

Could you give example/explain how one would code into this submit event the method to detect the bottom margin of the page (or other page position/formatting) and if nextInstance will excede margin, add a newPage with headerBlock and dataEntryControls repeating first at top of page followed by the nextInstance?

Thanks in advance</description>
		<content:encoded><![CDATA[<p>My form has a constant set of dynamic and static textFields for page 1 and 2, pg.2 having a header block that will need to be called to repeat to the top of a variable number of subsequent pages.</p>
<p>I need to create for the 3rd (+ pages) a set of data input fields that will create repeatable new subForm instances to the body of the page below, insert sentences/paragraphs of variable length from a dataBase (based on item codes) into each new instance and clear itself with each submission (button or enter key).</p>
<p>Could you give example/explain how one would code into this submit event the method to detect the bottom margin of the page (or other page position/formatting) and if nextInstance will excede margin, add a newPage with headerBlock and dataEntryControls repeating first at top of page followed by the nextInstance?</p>
<p>Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4895</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Fri, 08 Oct 2010 16:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4895</guid>
		<description>@Shishir P,

What exactly is the problem you&#039;re experiencing?</description>
		<content:encoded><![CDATA[<p>@Shishir P,</p>
<p>What exactly is the problem you&#8217;re experiencing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shishir P</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4894</link>
		<dc:creator>Shishir P</dc:creator>
		<pubDate>Sat, 02 Oct 2010 10:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4894</guid>
		<description>Hello,
      I was facing a similar problem and was hoping if you could help me, I have 3 dimensional array on the form, I have &quot;+&quot; and &quot; - &quot; buttons on the first level array, for every 1 record of top level array, the underlying arrays can have multple records. On the click of the button I am creating an instance and also require to replicate the number of records and along with data, so far I have managed to create an instance, this creates a single blank record in the underlying arrays as well, the script used is as below:-

/*
   This button will insert one instance of the repeating subform or table row.

   errMsg: The error message displayed.
*/
var errMsg = &quot;You have reached the maximum number of items allowed.&quot;;


var oWrapper = this.parent.parent;	// The outer subform built in to the object, enclosing the button group.
var oTargetSubform = oWrapper.parent.parent.parent;	// The subform or table row the controls are intended to manipulate.
var oManager = oTargetSubform.instanceManager; // Get the instance manager.
var nMaxCount = oManager.occur.max; 		// Get the maximum number of subform occurrences allowed.
var nSubCount = oManager.count;			// Get the current number of instances.

//----------------------------------------------------------------------------------------------------
// Current Index of the tables

//var index_T_ELEMENTS  = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.index;
//var index_T_COLL_CELL = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.index;
//var index_T_FIELD	  = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.DATA.T_FIELD.index;

// Current number of Records

var len_T_ELEMENTS	= this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.nodes.length;
var len_T_COLL_CELL = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.nodes.length;
var len_T_FIELD		= this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.DATA.T_FIELD.nodes.length;

// Proceed if the maximum number of subform occurrences has not been reached.
if ((nMaxCount == &quot;-1&quot;) &#124;&#124; (nSubCount &lt; nMaxCount)) {

	// Invoke the Instance Manager.
	var oNewInstance = oManager.addInstance(1);

//--------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------
	// Execute all the form calculations.
	xfa.form.recalculate(1);

	// Move the new subform below the current one.
	var nIndexFrom = oNewInstance.index;
	var nIndexTo = oTargetSubform.index + 1;
	oManager.moveInstance(nIndexFrom, nIndexTo);

 } else {

	xfa.host.messageBox(errMsg,&quot;Insert Item&quot;, 3);</description>
		<content:encoded><![CDATA[<p>Hello,<br />
      I was facing a similar problem and was hoping if you could help me, I have 3 dimensional array on the form, I have &#8220;+&#8221; and &#8221; &#8211; &#8221; buttons on the first level array, for every 1 record of top level array, the underlying arrays can have multple records. On the click of the button I am creating an instance and also require to replicate the number of records and along with data, so far I have managed to create an instance, this creates a single blank record in the underlying arrays as well, the script used is as below:-</p>
<p>/*<br />
   This button will insert one instance of the repeating subform or table row.</p>
<p>   errMsg: The error message displayed.<br />
*/<br />
var errMsg = &#8220;You have reached the maximum number of items allowed.&#8221;;</p>
<p>var oWrapper = this.parent.parent;	// The outer subform built in to the object, enclosing the button group.<br />
var oTargetSubform = oWrapper.parent.parent.parent;	// The subform or table row the controls are intended to manipulate.<br />
var oManager = oTargetSubform.instanceManager; // Get the instance manager.<br />
var nMaxCount = oManager.occur.max; 		// Get the maximum number of subform occurrences allowed.<br />
var nSubCount = oManager.count;			// Get the current number of instances.</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
// Current Index of the tables</p>
<p>//var index_T_ELEMENTS  = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.index;<br />
//var index_T_COLL_CELL = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.index;<br />
//var index_T_FIELD	  = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.DATA.T_FIELD.index;</p>
<p>// Current number of Records</p>
<p>var len_T_ELEMENTS	= this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.nodes.length;<br />
var len_T_COLL_CELL = this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.nodes.length;<br />
var len_T_FIELD		= this.parent.parent.parent.parent.parent.parent.parent.T_ELEMENTS.DATA.T_COLL_CELL.DATA.T_FIELD.nodes.length;</p>
<p>// Proceed if the maximum number of subform occurrences has not been reached.<br />
if ((nMaxCount == &#8220;-1&#8243;) || (nSubCount &lt; nMaxCount)) {</p>
<p>	// Invoke the Instance Manager.<br />
	var oNewInstance = oManager.addInstance(1);</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
	// Execute all the form calculations.<br />
	xfa.form.recalculate(1);</p>
<p>	// Move the new subform below the current one.<br />
	var nIndexFrom = oNewInstance.index;<br />
	var nIndexTo = oTargetSubform.index + 1;<br />
	oManager.moveInstance(nIndexFrom, nIndexTo);</p>
<p> } else {</p>
<p>	xfa.host.messageBox(errMsg,&quot;Insert Item&quot;, 3);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4893</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sat, 14 Aug 2010 01:49:17 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4893</guid>
		<description>@helary,

That&#039;s strange behaviour. I&#039;m not aware of a limit to the number of instances of subforms that a form can create at runtime.

The only thing I can suggest is that you structure your code such that minimum processing is required to generate the instances.</description>
		<content:encoded><![CDATA[<p>@helary,</p>
<p>That&#8217;s strange behaviour. I&#8217;m not aware of a limit to the number of instances of subforms that a form can create at runtime.</p>
<p>The only thing I can suggest is that you structure your code such that minimum processing is required to generate the instances.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: helary</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4892</link>
		<dc:creator>helary</dc:creator>
		<pubDate>Tue, 03 Aug 2010 06:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4892</guid>
		<description>Dear Stefan,

Time to visit your wonderful site again.

I have developed a pdf which will import data from excel file (around 60 fields per row). I need to add instance to a page dynamically for each input record read and then do some rendering before filling in the fields.

That&#039;s ok just for a few records but Reader will crash when no. of input records are more than 70-80, I have read some documents on how to improve performance in dynamic pdf forms but the problem lies on the complication of my form as it needs to according to requirement.

I wanna know if there is any limit on adding instance of a page or subform on runtime and any tips that I can get rid of the problem.

Rgds</description>
		<content:encoded><![CDATA[<p>Dear Stefan,</p>
<p>Time to visit your wonderful site again.</p>
<p>I have developed a pdf which will import data from excel file (around 60 fields per row). I need to add instance to a page dynamically for each input record read and then do some rendering before filling in the fields.</p>
<p>That&#8217;s ok just for a few records but Reader will crash when no. of input records are more than 70-80, I have read some documents on how to improve performance in dynamic pdf forms but the problem lies on the complication of my form as it needs to according to requirement.</p>
<p>I wanna know if there is any limit on adding instance of a page or subform on runtime and any tips that I can get rid of the problem.</p>
<p>Rgds</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4891</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Tue, 01 Jun 2010 02:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4891</guid>
		<description>@Kerry Steven,

The issue could be that you&#039;re setting focus to a table/subform. I think the scroll will only happen if setting the focus causes the insertion pointer (&quot;I-beam&quot;) to move to some field that is currently out of view.

Trying setting the focus on a field inside the instance of the subform/row you add.</description>
		<content:encoded><![CDATA[<p>@Kerry Steven,</p>
<p>The issue could be that you&#8217;re setting focus to a table/subform. I think the scroll will only happen if setting the focus causes the insertion pointer (&#8220;I-beam&#8221;) to move to some field that is currently out of view.</p>
<p>Trying setting the focus on a field inside the instance of the subform/row you add.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry Steven</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4890</link>
		<dc:creator>Kerry Steven</dc:creator>
		<pubDate>Thu, 20 May 2010 21:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4890</guid>
		<description>Thanks Stefan,

I tried the setFocus command, but the screen still does not move when the button is clicked.  I&#039;m using version 8.0.  Any assistance would be appreciated.

----- UnifiedFormat.page1.ChooseRejectionType.Button2::click: - (JavaScript, client) ---------------

_Rejection102.addInstance(1);
xfa.host.setFocus(Rejection102.somExpression);</description>
		<content:encoded><![CDATA[<p>Thanks Stefan,</p>
<p>I tried the setFocus command, but the screen still does not move when the button is clicked.  I&#8217;m using version 8.0.  Any assistance would be appreciated.</p>
<p>&#8212;&#8211; UnifiedFormat.page1.ChooseRejectionType.Button2::click: &#8211; (JavaScript, client) &#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>_Rejection102.addInstance(1);<br />
xfa.host.setFocus(Rejection102.somExpression);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4889</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sat, 01 May 2010 19:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4889</guid>
		<description>@Kerry Steven,

Usually, setting input focus on a form object will cause Acrobat/Reader to scroll to that location. You can set the focus like this:

&lt;pre&gt;&lt;code&gt;xfa.host.setFocus({formObject}.somExpression);&lt;/code&gt;&lt;/pre&gt;

where &quot;{formObject}&quot; is the name of the subform you have instantiated after the user clicked one of the buttons.</description>
		<content:encoded><![CDATA[<p>@Kerry Steven,</p>
<p>Usually, setting input focus on a form object will cause Acrobat/Reader to scroll to that location. You can set the focus like this:</p>
<pre><code>xfa.host.setFocus({formObject}.somExpression);</code></pre>
<p>where &#8220;{formObject}&#8221; is the name of the subform you have instantiated after the user clicked one of the buttons.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kerry Steven</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4888</link>
		<dc:creator>Kerry Steven</dc:creator>
		<pubDate>Mon, 26 Apr 2010 16:57:31 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4888</guid>
		<description>I am creating form in which user first chooses from a selection by pressing one of a plurality of buttons.  Each click of button creates a new instance of different subforms depending on button clicked on a new page.  However, the screen won&#039;t move to the newly created page! Do you know a script to add so that the screen moves to the newly created page?  I&#039;ve included page down, but that won&#039;t work if the new instance is on a third page.</description>
		<content:encoded><![CDATA[<p>I am creating form in which user first chooses from a selection by pressing one of a plurality of buttons.  Each click of button creates a new instance of different subforms depending on button clicked on a new page.  However, the screen won&#8217;t move to the newly created page! Do you know a script to add so that the screen moves to the newly created page?  I&#8217;ve included page down, but that won&#8217;t work if the new instance is on a third page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-4887</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sun, 21 Mar 2010 19:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-4887</guid>
		<description>@silentkiller_125,

Are you using relative expressions to access the form objects within the subform instance? If not, you might be always accessing the same instance, not the one that was just added.</description>
		<content:encoded><![CDATA[<p>@silentkiller_125,</p>
<p>Are you using relative expressions to access the form objects within the subform instance? If not, you might be always accessing the same instance, not the one that was just added.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

