<?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"
	>
<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>
	<pubDate>Sat, 22 Nov 2008 22:50:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: BAJ</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-31662</link>
		<dc:creator>BAJ</dc:creator>
		<pubDate>Mon, 20 Oct 2008 18:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-31662</guid>
		<description>CF has the same issue I am. The instance Manager is not holding Focus on the row (or column) that the user is editing.  

If you have a row that is generated by the Manager and it has code for a cell tied to a method it will work on the first instance on the sub form.  
If rows are added using the Manager, the code will continue to reference the information contained that same first instance (row) instead of changing focuse to the current instance that is being edited.

How do you tell the instance Manager that you are editing  (x)row ?</description>
		<content:encoded><![CDATA[<p>CF has the same issue I am. The instance Manager is not holding Focus on the row (or column) that the user is editing.  </p>
<p>If you have a row that is generated by the Manager and it has code for a cell tied to a method it will work on the first instance on the sub form.<br />
If rows are added using the Manager, the code will continue to reference the information contained that same first instance (row) instead of changing focuse to the current instance that is being edited.</p>
<p>How do you tell the instance Manager that you are editing  (x)row ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-30850</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Fri, 10 Oct 2008 21:14:04 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-30850</guid>
		<description>CF,

The Validate event isn't the right event to use for what you're trying to do, which isn't really a validation. What you should be doing is using the Change event in the State drop down list to look at the new selection and then add the appropriate items to the City drop down list. The following script is what you would put in the State field's Change event, in JavaScript:

&lt;pre&gt;&lt;code&gt;var newSelection = this.boundItem(xfa.event.newText);
City.clearItems(); // remove all city field items that may have already been added from a previous State selection
switch (newSelection)
{
    case "NY":
        City.addItem("New York");
        City.addItem("Other city");
        break;

    case "AZ":
        City.addItem("Phoenix");
        break;
}&lt;/code&gt;&lt;/pre&gt;

You shouldn't need to worry about the instances of the repeatable subform in order to get this to work in all the instances, assuming the State field selection is done by the user.</description>
		<content:encoded><![CDATA[<p>CF,</p>
<p>The Validate event isn&#8217;t the right event to use for what you&#8217;re trying to do, which isn&#8217;t really a validation. What you should be doing is using the Change event in the State drop down list to look at the new selection and then add the appropriate items to the City drop down list. The following script is what you would put in the State field&#8217;s Change event, in JavaScript:</p>
<pre><code>var newSelection = this.boundItem(xfa.event.newText);
City.clearItems(); // remove all city field items that may have already been added from a previous State selection
switch (newSelection)
{
    case "NY":
        City.addItem("New York");
        City.addItem("Other city");
        break;

    case "AZ":
        City.addItem("Phoenix");
        break;
}</code></pre>
<p>You shouldn&#8217;t need to worry about the instances of the repeatable subform in order to get this to work in all the instances, assuming the State field selection is done by the user.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CF</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-30534</link>
		<dc:creator>CF</dc:creator>
		<pubDate>Mon, 06 Oct 2008 18:52:27 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-30534</guid>
		<description>Hi Stefan,

I am trying to cascade the values in a dropdown box based on the value selected in another dropdown box within a repeating sub-form. In my case, the repeating sub-form contains a group of address fields, include dropdown boxes for State and City. Once the user selects a State, I want to limit the list of selectable Cities. I was able to make it work with a script in the validate event of the State field, but only for the first instance of the sub-form. Even though the event is executed for new instances of the subform, I couldn't manipulate the City list in the new instance. I have a feeling the solution has something to do with InstanceManager, but couldn't find any examples of how this is done.</description>
		<content:encoded><![CDATA[<p>Hi Stefan,</p>
<p>I am trying to cascade the values in a dropdown box based on the value selected in another dropdown box within a repeating sub-form. In my case, the repeating sub-form contains a group of address fields, include dropdown boxes for State and City. Once the user selects a State, I want to limit the list of selectable Cities. I was able to make it work with a script in the validate event of the State field, but only for the first instance of the sub-form. Even though the event is executed for new instances of the subform, I couldn&#8217;t manipulate the City list in the new instance. I have a feeling the solution has something to do with InstanceManager, but couldn&#8217;t find any examples of how this is done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-13135</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Mon, 15 Oct 2007 01:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-13135</guid>
		<description>Meng,

Sounds like a cool form you've put together!

The only thing that comes to mind as to why the fields go blank when you open the form with saved data is that the data connection you've defined is being opened when the form is initialized (opened in Acrobat). If a connection to the database can't be established, the resulting dataset is empty and that's what gets merged into the form, resulting in the fields becoming empty as well.

You may need to add a button or two on the form which users can use to control when data is retrieved from and sent to the database using the data connection. You could, for example, have a "retrieve" button whose Click event opens the data connection in order to get the data from the database. At that point, the user can save the form with the data and continue filling it offline. Later, when online again with the updated data, the user can click on the second button, the "update" button, and that can open the data connection in order to send the updated data to the database.

Have a look at the various ODBC data connection articles in my &lt;a href="http://forms.stefcameron.com/category/data-binding/" rel="nofollow"&gt;Data Binding&lt;/a&gt; section for some examples of the various things you may need to do.</description>
		<content:encoded><![CDATA[<p>Meng,</p>
<p>Sounds like a cool form you&#8217;ve put together!</p>
<p>The only thing that comes to mind as to why the fields go blank when you open the form with saved data is that the data connection you&#8217;ve defined is being opened when the form is initialized (opened in Acrobat). If a connection to the database can&#8217;t be established, the resulting dataset is empty and that&#8217;s what gets merged into the form, resulting in the fields becoming empty as well.</p>
<p>You may need to add a button or two on the form which users can use to control when data is retrieved from and sent to the database using the data connection. You could, for example, have a &#8220;retrieve&#8221; button whose Click event opens the data connection in order to get the data from the database. At that point, the user can save the form with the data and continue filling it offline. Later, when online again with the updated data, the user can click on the second button, the &#8220;update&#8221; button, and that can open the data connection in order to send the updated data to the database.</p>
<p>Have a look at the various ODBC data connection articles in my <a href="http://forms.stefcameron.com/category/data-binding/" rel="nofollow">Data Binding</a> section for some examples of the various things you may need to do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Meng</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-12208</link>
		<dc:creator>Meng</dc:creator>
		<pubDate>Mon, 01 Oct 2007 15:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-12208</guid>
		<description>Hi Stefan,

I have established a database connection in my forms such that whenever an user selects a value from a drop-down list, all the related fields will be updated with corresponding data records from the database. Besides, data records in database will be updated whenever an exit event is triggered as users modify/edit field data.

Since this solution is only possible when there's a connection to the database (on-line), it would be much more convenient for my users to have an off-line version which enables them to input any data and save it locally before doing the update to database when they have access to database again.

So i have tried to save the forms with populated values from the database. But when I open the pdf again all the data are gone. Why is this happening?

Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi Stefan,</p>
<p>I have established a database connection in my forms such that whenever an user selects a value from a drop-down list, all the related fields will be updated with corresponding data records from the database. Besides, data records in database will be updated whenever an exit event is triggered as users modify/edit field data.</p>
<p>Since this solution is only possible when there&#8217;s a connection to the database (on-line), it would be much more convenient for my users to have an off-line version which enables them to input any data and save it locally before doing the update to database when they have access to database again.</p>
<p>So i have tried to save the forms with populated values from the database. But when I open the pdf again all the data are gone. Why is this happening?</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-62</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Tue, 03 Apr 2007 23:10:56 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-62</guid>
		<description>Iulia,

Unfortunately, I don't think you'll be able to save the form silently using a button on a form.

The problem with a silent save (i.e. just "save" instead of "save as") is that it's a security risk to the person using the form since they don't know that it's happening.

You can, however, trigger a "save as" action from a button like this (in JavaScript only):

&lt;blockquote&gt;app.execMenuItem("SaveAs");&lt;/blockquote&gt;

If you want to hide the save button prior to the save, you would just need to add this line prior to executing the menu item:

&lt;blockquote&gt;this.presence = "invisible";&lt;/blockquote&gt;

You can find more information on app.execMenuItem and its restrictions in the &lt;a href="http://www.adobe.com/devnet/acrobat/javascript.html" rel="nofollow"&gt;JavaScript for Acrobat API Reference&lt;/a&gt;, page 120.
</description>
		<content:encoded><![CDATA[<p>Iulia,</p>
<p>Unfortunately, I don&#8217;t think you&#8217;ll be able to save the form silently using a button on a form.</p>
<p>The problem with a silent save (i.e. just &#8220;save&#8221; instead of &#8220;save as&#8221;) is that it&#8217;s a security risk to the person using the form since they don&#8217;t know that it&#8217;s happening.</p>
<p>You can, however, trigger a &#8220;save as&#8221; action from a button like this (in JavaScript only):</p>
<blockquote><p>app.execMenuItem(&#8221;SaveAs&#8221;);</p></blockquote>
<p>If you want to hide the save button prior to the save, you would just need to add this line prior to executing the menu item:</p>
<blockquote><p>this.presence = &#8220;invisible&#8221;;</p></blockquote>
<p>You can find more information on app.execMenuItem and its restrictions in the <a href="http://www.adobe.com/devnet/acrobat/javascript.html" rel="nofollow">JavaScript for Acrobat API Reference</a>, page 120.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iulia</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-61</link>
		<dc:creator>Iulia</dc:creator>
		<pubDate>Tue, 03 Apr 2007 08:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-61</guid>
		<description>Hi,

Never mind about the help file; I found it on 
&lt;a href="http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf" rel="nofollow"&gt; http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf&lt;/a&gt;

However, the question related to adding a Save button to the form still remains.

Many thanks,
Iulia</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Never mind about the help file; I found it on<br />
<a href="http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf" rel="nofollow"> </a><a href="http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf" rel="nofollow">http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pdf</a></p>
<p>However, the question related to adding a Save button to the form still remains.</p>
<p>Many thanks,<br />
Iulia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iulia</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-60</link>
		<dc:creator>Iulia</dc:creator>
		<pubDate>Mon, 02 Apr 2007 08:14:36 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-60</guid>
		<description>Hi Stefan,

You are so right! Thank you very much.

I succeeded to save the form using the Acrobat Reader "Save" button, but I now have another question: I wanted to add a "Save" button to the form and when it is clicked to hide it and save the form (with the "Save" button hidden).

For starters, I tried to put app.execMenuItem("Save") on the button click event but again, nothing happens.

Can you shed some light on this, too? And can you indicate a help file or something similar to describe the pdf form structure objects (like xfa)? 

Thank you,
Iulia</description>
		<content:encoded><![CDATA[<p>Hi Stefan,</p>
<p>You are so right! Thank you very much.</p>
<p>I succeeded to save the form using the Acrobat Reader &#8220;Save&#8221; button, but I now have another question: I wanted to add a &#8220;Save&#8221; button to the form and when it is clicked to hide it and save the form (with the &#8220;Save&#8221; button hidden).</p>
<p>For starters, I tried to put app.execMenuItem(&#8221;Save&#8221;) on the button click event but again, nothing happens.</p>
<p>Can you shed some light on this, too? And can you indicate a help file or something similar to describe the pdf form structure objects (like xfa)? </p>
<p>Thank you,<br />
Iulia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-59</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Sat, 31 Mar 2007 02:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-59</guid>
		<description>Iulia,

The command you're referring to ("Advanced &#124; Enable Usage Rights in Adobe Reader") in Acrobat Pro 8.0 can still be used with dynamic forms created in Designer (you can even use an earlier version of Designer like 7.1 if you wish).

Simply create the form in Designer, save it as a Dynamic PDF form and open it in Acrobat Pro 8.0. That command will then be available to you and you'll be able to save the form with Usage Rights enabled (e.g. data save) such that the user will be able to save the entire PDF along with the data using the Adobe Reader.</description>
		<content:encoded><![CDATA[<p>Iulia,</p>
<p>The command you&#8217;re referring to (&#8221;Advanced | Enable Usage Rights in Adobe Reader&#8221;) in Acrobat Pro 8.0 can still be used with dynamic forms created in Designer (you can even use an earlier version of Designer like 7.1 if you wish).</p>
<p>Simply create the form in Designer, save it as a Dynamic PDF form and open it in Acrobat Pro 8.0. That command will then be available to you and you&#8217;ll be able to save the form with Usage Rights enabled (e.g. data save) such that the user will be able to save the entire PDF along with the data using the Adobe Reader.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iulia</title>
		<link>http://forms.stefcameron.com/2006/05/18/instantiating-subforms-at-runtime/#comment-58</link>
		<dc:creator>Iulia</dc:creator>
		<pubDate>Wed, 28 Mar 2007 10:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=11#comment-58</guid>
		<description>Hi Stefan,

I have a question related to how we can save such a form (after it was filled by the user). 

If you design a form with Adobe Acrobat Professional there is a setting you can do to enable users to save the form (Advanced menu &gt; Enable User Rights in Acrobat Reader). But since creating dynamic forms is only possible in LiveCycle Designer I cannot make the same setting and buying licenses of Acrobat Reader Extensions for all users is not an option.

I tried to add a Submit button on the form which sends PDF (connected to an ASP.NET application). I click on it but nothing happens. I also tried to put a simple button which runs the following Javascript on mouse up:

&lt;i&gt; form1.#subform[0].Button1::mouseUp: - (JavaScript, client) 

// Saving the form is done at the application level, so you need to invoke the
// Acrobat app model.
App.executeMenuItem("SaveAs"); // The end user will be prompted to specify a
// file name.
// However, you must save the form silently if the form needs to be certified
// and the certificate must be trusted for privileged JavaScript.
var mydoc = event.target;
mydoc.saveAs(); &lt;/i&gt;

Nothing happens either.

Can you tell me please if there is another solution? Please note I need to save the entire pdf, not only the data entered by the user.

Thanks in advance,
Iulia</description>
		<content:encoded><![CDATA[<p>Hi Stefan,</p>
<p>I have a question related to how we can save such a form (after it was filled by the user). </p>
<p>If you design a form with Adobe Acrobat Professional there is a setting you can do to enable users to save the form (Advanced menu > Enable User Rights in Acrobat Reader). But since creating dynamic forms is only possible in LiveCycle Designer I cannot make the same setting and buying licenses of Acrobat Reader Extensions for all users is not an option.</p>
<p>I tried to add a Submit button on the form which sends PDF (connected to an ASP.NET application). I click on it but nothing happens. I also tried to put a simple button which runs the following Javascript on mouse up:</p>
<p><i> form1.#subform[0].Button1::mouseUp: - (JavaScript, client) </p>
<p>// Saving the form is done at the application level, so you need to invoke the<br />
// Acrobat app model.<br />
App.executeMenuItem(&#8221;SaveAs&#8221;); // The end user will be prompted to specify a<br />
// file name.<br />
// However, you must save the form silently if the form needs to be certified<br />
// and the certificate must be trusted for privileged JavaScript.<br />
var mydoc = event.target;<br />
mydoc.saveAs(); </i></p>
<p>Nothing happens either.</p>
<p>Can you tell me please if there is another solution? Please note I need to save the entire pdf, not only the data entered by the user.</p>
<p>Thanks in advance,<br />
Iulia</p>
]]></content:encoded>
	</item>
</channel>
</rss>
