<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stefan Cameron on Forms &#187; Instance Manager</title>
	<atom:link href="http://forms.stefcameron.com/category/instance-manager/feed/" rel="self" type="application/rss+xml" />
	<link>http://forms.stefcameron.com</link>
	<description>Building intelligent forms using Adobe LiveCycle Designer</description>
	<lastBuildDate>Wed, 16 Feb 2011 22:56:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Final Post: XFA Tank Wars</title>
		<link>http://forms.stefcameron.com/2010/12/03/final-post-xfa-tank-wars/</link>
		<comments>http://forms.stefcameron.com/2010/12/03/final-post-xfa-tank-wars/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 22:00:42 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/?p=602</guid>
		<description><![CDATA[Dear Readers and Fellow Form Developers, The time has come for me to focus my extra energy on other goals and projects at Adobe and at home. I have thoroughly enjoyed helping the XFA community for these past 4.5 years. All of the content on this blog was a direct result of your questions and [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Readers and Fellow Form Developers,</p>
<p>The time has come for me to focus my extra energy on other goals and projects at Adobe and at home.</p>
<p>I have thoroughly enjoyed helping the XFA community for these past 4.5 years. All of the content on this blog was a direct result of your questions and I learned a great deal about Adobe&#8217;s <a href="http://partners.adobe.com/public/developer/xml/index_arch.html">XFA technology</a> and its <a href="http://adobe.com/go/livecycle">LiveCycle Enterprise Suite</a> along the way. <strong>Thank you!</strong></p>
<p>I leave you now with a final &#8220;form to end all forms&#8221; (in my mind, anyway): A version of the classic <a href="http://forms.stefcameron.com/xfa-tank-wars/">Tank Wars game</a> implemented entirely in XFA + JavaScript.</p>
<p>Why do this, you wonder? Well, it was a good challenge, you couldn&#8217;t embed <a href="http://blogs.adobe.com/formfeed/2010/12/flash-in-xfa-sample-column-chart.html">Flash in an XFA form</a> back then and I wanted to do something that would really put LiveCycle Designer&#8217;s Script Editor through its usability paces.</p>
<p>Comments are now closed on all posts and pages except for this one and the <a href="http://forms.stefcameron.com/xfa-tank-wars/">XFA Tank Wars</a> page which will close on December 31, 2010. I will continue to host this blog for your reference and bookmarks however I cannot guarantee it will be available forever.</p>
<p>Good luck on all your present and future form development projects.</p>
<p>Stefan</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2010/12/03/final-post-xfa-tank-wars/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PDF Forms Bible Review</title>
		<link>http://forms.stefcameron.com/2009/11/13/pdf-forms-bible-review/</link>
		<comments>http://forms.stefcameron.com/2009/11/13/pdf-forms-bible-review/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 23:13:18 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/11/13/pdf-forms-bible-review/</guid>
		<description><![CDATA[Last February, I announced the release of a new Designer book titled, &#8220;PDF Forms Using Acrobat and LiveCycle Designer Bible&#8221;. Over the past few months, I had the opportunity to review it and I thought I would share my comments, with respect to the second-half of the book, which deals with LiveCycle Designer ES and [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float: left; margin-right: 15px" alt="PDF Forms Using Acrobat and LiveCycle Designer Bible" src="http://forms.stefcameron.com/images/pdfforms-book-cover.jpg">
<p>Last February, I announced the release of a <a href="http://forms.stefcameron.com/2009/02/05/new-book-acrobat-and-designer-bible/">new Designer book</a> titled, &#8220;PDF Forms Using Acrobat and LiveCycle Designer Bible&#8221;.</p>
<p>Over the past few months, I had the opportunity to review it and I thought I would share my comments, <strong>with respect to the second-half of the book</strong>, which deals with LiveCycle Designer ES and XFA forms, to help you decide if it would be a good book for you*. (The first-half deals with authoring PDF forms, a.k.a. AcroForms, in Acrobat and is beyond the scope of my blog.)</p>
<div style="clear: both; display: block">
<p><strong>Pros:</strong></p>
<ul>
<li>explains the licensing agreement involved when enabling forms for Reader using Acrobat&#8217;s &#8220;Extend Features in Adobe Reader&#8221; feature (p. 268) &#8212; this is a frequently-used feature however its governing licensing agreement, seldom understood, is explained here in &#8220;plain English&#8221;;
<li>presents and reasons through different design approaches for a particular solution, helping the reader make an informed decision on the best course of action;
<li>anything and everything you could possibly want to know is dealt with in some way;
<li>lots of important, time-saving insights in the inline &#8216;notes&#8217;;
<li>something for everyone from beginner to advanced;
<li>many cross-references between various topics, making it very easy to start in any chapter and still find all the information you need.</li>
</ul>
<p><strong>Caution:</strong></p>
<ul>
<li>risk of &#8220;information overload&#8221; &#8212; use this book as <em>reference</em> since it&#8217;s not a light read, though their goal is simply to present a myriad of options and let you pick the one that best suits your needs.</li>
</ul>
<p><strong>Overview of Topics Covered:</strong></p>
<ul>
<li>all about tables (from simple layouts to advanced);
<li>data merging with bindings;
<li>Designer user interface details and lots of tips and tricks for accelerating form layout tasks;
<li>working with static forms (with PDF backgrounds) and dynamic forms, highlighting the differences;
<li>great details on all sorts of pagination options;
<li>lots of detail on JavaScript and FormCalc, good scripting exercises with explanations, debugging tips, table with JavaScript and equivalent FormCalc functions to make it easy to script in either language if the other is more familiar to you;
<li>form deployment options;
<li>when and how to use data connections in your forms (XML, schema, database, web service) and setting data bindings;
<li>great overview of LiveCycle ES, its components (e.g. LC Forms, LC Reader Extensions, LC Rights Management, LC Content Services, etc.) and what they do.</li>
</ul>
<p>This book is available now on <a href="http://www.amazon.com/Forms-Using-Acrobatand-LiveCycle-Designer/dp/047040017X">Amazon.com</a> and <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-047040017X.html">Wiley.com</a> and <a href="http://www.google.ca/search?q=pdf+forms+bible">elsewhere</a>.</p>
<p style="font-size: 9px">* Please note that these opinions are not necessarily those of Adobe Systems Incorporated.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/11/13/pdf-forms-bible-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting to a Schema</title>
		<link>http://forms.stefcameron.com/2009/08/03/connecting-to-a-schema/</link>
		<comments>http://forms.stefcameron.com/2009/08/03/connecting-to-a-schema/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 11:00:19 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[FormCalc]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/08/03/connecting-to-a-schema/</guid>
		<description><![CDATA[In previous tutorials, I have shown how to connect an XFA form to a database and a web service. Next on the list is the XML Schema (XSD). If you work in an enterprise setting, chances are you may have already had to deal with corporate data schemas that define how that data is structured. [...]]]></description>
			<content:encoded><![CDATA[<p>In previous tutorials, I have shown how to connect an XFA form to a <a href="http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/">database</a> and a <a href="http://forms.stefcameron.com/2007/05/21/connecting-to-a-web-service/">web service</a>. Next on the list is the <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema</a> (XSD).</p>
<p>If you work in an enterprise setting, chances are you may have already had to deal with corporate data schemas that define how that data is structured. The goal, when connecting a form to a schema, is to ensure that the data consumed and output by the form adheres to a specific structure. Any fields bound to data nodes that aren&#8217;t inside the schema space are basically ignored at time of submission.</p>
<p><span id="more-410"></span>
<p>To help put things in context, I decided to define a schema for <a href="http://forms.stefcameron.com/samples/data-binding/schema/movieRental.xsd">movie rentals</a> to stay on the movie theme for the data I used in my other data connection tutorials.</p>
<p>Before we get started, I wanted to point-out that there are so many features related to schema handling and the Data View palette that I won&#8217;t be able to cover them all in a single tutorial. It would be information overload. Instead, I&#8217;ll try to point-out the basics along with a few interesting things that I think would be useful.</p>
<h2>Creating the Connection</h2>
<p><strong><font color="#008000">Right-click in the Data View palette and choose &#8220;New Data Connection&#8221;.</font></strong> In the first step, set the name for the connection (I set it to &#8220;SchemaConnection&#8221; so it&#8217;s easy to identify amongst any other connections that might be defined) and choose &#8220;XML Schema&#8221; as the type.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-1.jpg"></p>
<p>Note that while you may have multiple ODBC and web service data connections, <strong>a form may be connected to only one schema</strong>. As of <a href="http://forms.stefcameron.com/2009/03/24/xfa-30-specification-available/">XFA 3.0</a> (Designer ES2, Acrobat/Reader 9.1), however, you can inject foreign data nodes into the Data DOM even if they aren&#8217;t in the schema, which may help if you need to get extra data into/out of your form (a topic for another post; for now, have a look at the new &#8220;File &gt; Form Properties &gt; Data Binding tab&#8221; in the <a href="http://blogs.adobe.com/mtg/2009/07/adobe_livecycle_es_next_beta_a.html">Designer ES2 Beta</a>). You can also merge schemas into a single, larger schema (&lt;import/&gt; nodes are supported which can make importing multiple schemas into a single one relatively easy).</p>
<p>The next and final steps are to choose the schema file and root element. Depending on how your schema is defined, you may have a choice of elements to use as the root. In the Movie Rental schema, there is only one root: &#8220;movieRental&#8221;.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-2.jpg"></p>
<p>There are other options that let you embed the schema definition into your form (good if you don&#8217;t want to have to keep the schema file along with your form; otherwise, whenever you edit your form, you will need to ensure that the schema file is available) as well as specify XSLT files for incoming and outgoing data transformations (also a topic for another post).</p>
<h2>Data View Palette</h2>
<p>The initial view of the connection in the palette shows the data structure specified by the schema as represented in XFA. Each node in the schema gets an associated XFA object type depending on its description.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-3.jpg"></p>
<p>For example:</p>
<ul>
<li>Complex types (such as {customer} and {movie}) are usually mapped to subforms since they are elements that contain child elements.
<li>Simple types (such as {customer.firstName} and {customer.prov}) are typically mapped to XFA fields. As you can see, the Schema Data Connection Wizard detected various types and assigned specific XFA fields to each data node: The {customer.prov} node is set to a drop down list because that element is defined as an enumeration of specific values in the schema while {movie.cost} is set to a decimal field because it&#8217;s type is &#8220;xs:decimal&#8221;.</li>
</ul>
<h2>Root Subform Name</h2>
<p>When the connection was created, there was a change to your form&#8217;s root subform name. Note how it has changed to <strong>movieRental</strong>:</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-4.jpg"></p>
<p>The name of the root subform is always the name of the root data element in the Data DOM. This ensures that data submitted from the form has the correct root element to match the schema and data merged into the form will be bound first by the root subform, then by child form objects.</p>
<h2>Inserting New Fields</h2>
<p>The Data View palette can be used to insert fields into your form. This makes it really easy to create new fields with the proper settings and bindings. You can customize how fields are created by choosing &#8220;Palette menu button <img style="display: inline" src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-5.jpg"> &gt; Options&#8221;:</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-6.jpg"></p>
<ul>
<li><strong>Generate Validation Scripts: </strong>If enabled, field Validate events will be generated for elements that have certain restraints defined in the schema.
<li><strong>Generate Descriptive Information:</strong> If enabled, particular forms of <a href="http://forms.stefcameron.com/2009/08/28/schema-metadata/">metadata in the schema</a> will be inserted into the field definitions in your form (more on this in another post).
<li><strong>Allow Tables to be Generated:</strong> If enabled, tables, rather than plain subforms, will be generated where appropriate.
<li><strong>Show Binding Properties Dialog Box:</strong> If enabled and you drag &amp; drop an element onto an existing field, a customization dialog will be displayed (more on this later).</li>
</ul>
<p>To insert a <em>new</em> field configured according to an element in the schema, just drag &amp; drop the element from the connection tree (in the Data View palette) into your form. You can add an entire group in a single operation by dragging a container element (e.g. {customer}). When a field in your form is bound to an element in the schema, a binding icon is displayed next to the element in the connection tree.</p>
<p><strong><font color="#008000">Start by dragging and dropping the {customer} element into your form.</font></strong> The result should be a new subform named &#8220;customer&#8221; containing 8 fields named according to the schema&#8217;s {customer} element and the elements it contains.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-7.jpg"><br />New fields on the form.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-8.jpg"><br />New structure in the hierarchy.</p>
<p>Notice how each leaf element in the connection now has a binding icon next to it in the connection tree (indicating that fields on the form are bound to those schema elements). The inserted fields were also customized according to their schema element counterparts. For example:</p>
<ul>
<li>All fields have appropriate data bindings (see &#8220;Object palette &gt; Bindings tab &gt; Data Binding property&#8221;).
<li>The {customer.prov} element became a drop down list which has a list of items, as well as a default value of &#8220;ON&#8221;, as specified in the schema.
<li>All new form objects have names that match their schema element names (though these could be altered, if better suited to any scripting requirements you may have, without affecting the data bindings).
<li>All new form objects have captions that are derived from their schema element names (e.g. the field bound to {customer.firstName} has a caption of &#8220;First Name&#8221;).</li>
</ul>
<p><strong><font color="#008000">Next, drag and drop the {movie} element from the connection into your form.<br />
</font></strong> This element is special because the schema specifies it may have multiple occurrences:</p>
<pre><code>&lt;xs:element
    name="movie"
    type="movieDef"
    minOccurs="1"
    maxOccurs="unbounded"/&gt;</code></pre>
<p>The result is a <strong>repeatable subform</strong>, as you can see by the Binding properties that were automatically set on the new &#8220;movie&#8221; subform (bound to movie[*] with Min Count set to 1 and no specified Max Count (unbounded)):</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-9.jpg"></p>
<p>(Note that if the properties on the &#8220;Object palette &gt; Binding tab&#8221; are partially disabled, it&#8217;s most likely because the movie subform is not inside a <em>flowed</em> container. Though it isn&#8217;t an XFA requirement, Designer requires it in order to enable the repeatable properties. We&#8217;ll fix this shortly.)</p>
<h2>Binding to Existing Fields</h2>
<p>There are two ways to bind an <em>existing</em> field to an element in the schema connection:</p>
<ol>
<li>Simply choose the element to which the field should bind by using the &#8220;Object palette &gt; Binding tab &gt; Data Binding property&#8221; pop-out menu (button to the right-hand side of the property) and selecting it from within the schema connection&#8217;s sub menu.
<li>Drag an element from the connection tree, in the Data View palette, and drop it on top of a field in your form. Doing so will &#8212; if it&#8217;s enabled &#8212; cause the <strong>Binding Properties Dialog Box</strong> to be displayed, giving you some options to further customize the existing field with information from the schema.</li>
</ol>
<h3><strong>Binding Properties Dialog Box</strong></h3>
<p><strong><font color="#008000">Add a new text field to your form.</font></strong> This will be for the {returnBy} schema element. Ensure that the &#8220;Show Binding Properties Dialog Box&#8221; option is checked in the &#8220;Data View palette &gt; Palette menu button &gt; Options&#8221; dialog. Now drag the {returnBy} element from the connection and drop it on top of the new text field.</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-10.jpg"></p>
<p>The above dialog will be displayed, giving you the option to update the following properties of the field on which the schema element was dropped:</p>
<ul>
<li><strong>Name:</strong> Updates the name of the field to match the name of the schema element (from &#8220;TextField1&#8243; to &#8220;returnBy&#8221;).
<li><strong>Caption:</strong> Updates the caption of the field to one derived from the schema (from &#8220;Text Field&#8221; to &#8220;Return By&#8221;).
<li><strong>Type:</strong> Updates the field&#8217;s object type to match the kind of data represented by the schema element (from text field to date/time field).
<li><strong>Type &gt; Default Value:</strong> Updates the field&#8217;s default value to that specified in the schema, if any (in the case of {returnBy}, the schema does not specify a default value).
<li><strong>Type &gt; Data Pattern:</strong> Updates the field&#8217;s patterns (display, edit, validate, data) according to the schema (in the case of {returnBy}, no pattern restrictions are specified in the schema, though a &#8220;date{YYYY-MM-DD}&#8221; data pattern will be set by default).</li>
</ul>
<p>Choose the &#8220;Update all related properties&#8221; option and click on the &#8220;OK&#8221; button. The text field you previously inserted will be updated to a date/time field with various properties matching the {returnBy} schema element&#8217;s specifications (as detailed above).</p>
<h2>Finishing Touches</h2>
<p>At this point, your form should look something like this (the positioning of the objects may differ depending on where you dropped them):</p>
<p><img src="http://forms.stefcameron.com/images/SchemaConnection/SchemaConnection-11.jpg"></p>
<p>Here are a few steps you can take to make things look a little nicer (in my opinion) as well as enable instances of the movie subform to be added for new movies to rent:</p>
<ol>
<li>Place the movie subform in a flowed subform so that <a href="http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/">multiple instances</a> can be added, flowed one after the other.
<li>Place an &#8220;add&#8221; button next to the movie subform to add instances as well as a &#8220;remove&#8221; button inside the movie subform to remove specific instances.
<li>Add an unbound decimal field that shows the running total cost for the movie rental order.
<li>Add script to the returnBy field to automatically set the date 30 days in the future.
<li>Add a submit button to submit the order.</li>
</ol>
<p>Following the steps above should yield a more functional movie rental form. The only thing missing is the ability to pull-in movies to choose from. For one thing, this would avoid having to specify the movie ID, title and cost when choosing a movie to rent. To accomplish this, you could connect the form to a movie <a href="http://forms.stefcameron.com/2006/10/12/displaying-all-records-from-an-odbc-data-connection/">database</a> (note that the database in the linked tutorial doesn&#8217;t have a &#8220;cost&#8221; column associated to a movie so you&#8217;ll have to add one) or, the <strong>more secure and recommended way</strong>, to a movie <a href="http://forms.stefcameron.com/2007/05/21/connecting-to-a-web-service/">web service</a>.</p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/schema/ConnectingToSchema.pdf">Download Sample Form [pdf]</a></p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/schema/movieRental.xsd">Download Schema [xsd]</a></p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/schema/movieRental-Sample.xml">Download Sample Data [xml]</a></p>
<p><strong>Minimum Requirements:</strong> I designed this form using Designer ES2 Beta and Acrobat 9.1 however the principals should work all the way back to Designer 7.1 and Acrobat 7.0.5. There may be a few features lacking from the Data View palette if you go back that far but the concept of connecting the form to a schema remains the same.</p>
<p class="postUpdate"><strong>Aug 28, 2009</strong> &mdash; Added link to <a href="http://forms.stefcameron.com/2009/08/28/schema-metadata/">Schema Metadata</a> tutorial.</p>
<p class="postUpdate"><strong>Nov 4, 2009</strong> &mdash; Fixed a couple of syntax errors in the sample PDF form that were preventing the addition and removal of movie subform instances.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/08/03/connecting-to-a-schema/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Creating and Loading Data Nodes</title>
		<link>http://forms.stefcameron.com/2009/06/01/creating-and-loading-data-nodes/</link>
		<comments>http://forms.stefcameron.com/2009/06/01/creating-and-loading-data-nodes/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 11:00:03 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[CM]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/06/01/creating-and-loading-data-nodes/</guid>
		<description><![CDATA[Have you ever needed to create data nodes in the Data DOM on-the-fly? How about a need to parse XML obtained from a web service data connection in order to find a value for some property? If that&#8217;s the case, then you&#8217;ll find-out how to do it in this article. Creating Data Nodes In a [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to create data nodes in the Data DOM on-the-fly? How about a need to parse XML obtained from a <a href="http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/">web service data connection</a> in order to find a value for some property? If that&#8217;s the case, then you&#8217;ll find-out how to do it in this article.</p>
<h2>Creating Data Nodes</h2>
<p>In a similar article, John Brinkman showed how to <a href="http://blogs.adobe.com/formfeed/2008/10/form_variables.html">create form variable nodes</a> at runtime however what&#8217;s not obvious about data nodes is that you don&#8217;t create them using
<p>a class name of your choice.</p>
<p>For example, say you wanted to create the following data node structure:</p>
<pre><code>&lt;custom&gt;
    &lt;message&gt;Hello World!&lt;/message&gt;
&lt;/custom&gt;</code></pre>
<p>&nbsp;</p>
<p><span id="more-372"></span></p>
<p>Given the following syntax for the createNode() function (see page 367 in the <a href="http://www.adobe.com/go/learn_lc_scriptingReference_82">LC Designer 8.2 Scripting Reference</a>):</p>
<pre><code>{model}.createNode(className [, name, namespace]);</code></pre>
<p>you might try the following, using &#8220;custom&#8221; as the class name for the first group/container node &lt;custom&gt;:</p>
<pre><code>var n = createNode("custom");</code></pre>
<p>Doing the above would generate an error stating that &#8220;custom&#8221; is an invalid node type.</p>
<p>The trick here is that only specific XFA class names are allowed, such as &#8220;text&#8221;, &#8220;decimal&#8221;, &#8220;integer&#8221;, etc., as well as two special types for data nodes: &#8220;dataGroup&#8221; and &#8220;dataValue&#8221;. When you need a data node that will <em>contain</em> other data nodes, you use the &#8220;dataGroup&#8221; class. When you need a data node to which you will <em>assign</em> a value, you use the &#8220;dataValue&#8221; node.</p>
<p>The JavaScript code to create the above XML structure then becomes:</p>
<pre><code>// &lt;custom&gt; data group to contain &lt;message&gt;
var c = xfa.datasets.createNode("dataGroup", "custom");
// &lt;message&gt; data value for "Hello World!"
var m = xfa.datasets.createNode("dataValue", "message");
// set value of data value node
m.value = "Hello World!";
// add &lt;message&gt; into &lt;custom&gt; data group node
c.nodes.append(m);
// print result to JavaScript Console (Ctrl + J in Acrobat)
console.println(c.saveXML("pretty"));

// output from above:

&lt;custom&gt;
    &lt;message&gt;Hello World!&lt;/message&gt;
&lt;/custom&gt;
</code></pre>
<p>Note that the createNode() function must be called on an object of type &#8220;model&#8221; and since we&#8217;re creating nodes in the Data DOM, we use the xfa.datasets object since it is a model object.</p>
<p>At this point, the &lt;custom&gt; node (and the nodes/values it contains) is <strong>not</strong> part of the Data DOM. To add it to the Data DOM so that it gets submitted with the rest of the form&#8217;s data, you would have to append it to a node <strong>inside</strong> the root subform (the top-most subform in the Hierarchy palette). For example, if your root subform&#8217;s name was &#8220;form1&#8243;, you would do the following to add the &lt;custom&gt; node to the form&#8217;s data:</p>
<pre><code>xfa.datasets.data.form1.nodes.append(c);</code></pre>
<p>This can be very useful. In fact, this technique is used in <a href="http://forms.stefcameron.com/category/cm/">Correspondence Management</a> letter template scripts to flag a selection list&#8217;s default selection as having been processed. Since the data merged into the list to print the letter based on the template may not match the default selection in the list, the scripts generate a special node directly in the Data DOM to indicate whether the list&#8217;s data value should be processed instead of its default selection (i.e. no need for a hidden checkbox field for each list, keeping the form/PDF file size down).</p>
<p>The &#8220;Custom Node Example&#8221; section in my <a href="http://forms.stefcameron.com/samples/data-binding/CreateLoadDataNode.pdf">sample form</a> demonstrates the above technique.</p>
<h2>Loading Data Nodes</h2>
<p>Another use for creating data nodes is they give you the ability to load existing XML in order to parse it without having to modify the Data DOM. If you create a new, orphaned (un-parented) data group node, you can use its loadXML() function to load an XML string into it, thereby giving you a handy XML node structure for parsing.</p>
<p>One example use of this would be in a form that retrieves various settings from a web service data connection where the structure of the returned data is determined by the input parameters (i.e. you have a single data connection which you can use to retrieve various data). You can return the XML data as a string and load it into a new data group node in order to parse-out the value you&#8217;re looking for without ever touching the Data DOM.</p>
<p>Another example would be an extension of my <a href="http://forms.stefcameron.com/2006/10/20/using-url-requests-in-pdf-forms/">URL Request</a> article. In this case, you could pass some XML data into your form via the URL request if your PDF form was available on a website. <font color="#ff0000"><strong>Warning:</strong> This is a not a secure method to pass data to your form.</font></p>
<p>Clicking the following link will load some movie data into the &#8220;Movies loadXML() Example&#8221; section of my sample form:</p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/CreateLoadDataNodes.pdf?data=%3Cmovies%3E%3Cmovie%3E%3Ctitle%3ENacho%20Libre%3C%2Ftitle%3E%3Ccost%3E21.00%3C%2Fcost%3E%3CactorName%3EJack%20Black%3C%2FactorName%3E%3CcatName%3EComedy%3C%2FcatName%3E%3C%2Fmovie%3E%3Cmovie%3E%3Ctitle%3EMI%3AI%3C%2Ftitle%3E%3Ccost%3E20.00%3C%2Fcost%3E%3CactorName%3ETom%20Cruise%3C%2FactorName%3E%3CcatName%3EAction%3C%2FcatName%3E%3C%2Fmovie%3E%3C%2Fmovies%3E">CreateLoadDataNodes.pdf?data=%3Cmovies%3E%3Cmovie%3E%3Ctitle%3ENacho%20Libre%3C%2Ftitle%3E%3Ccost%3E21.00%3C%2Fcost%3E%3CactorName%3EJack%20Black%3C%2FactorName%3E%3CcatName%3EComedy%3C%2FcatName%3E%3C%2Fmovie%3E%3Cmovie%3E%3Ctitle%3EMI%3AI%3C%2Ftitle%3E%3Ccost%3E20.00%3C%2Fcost%3E%3CactorName%3ETom%20Cruise%3C%2FactorName%3E%3CcatName%3EAction%3C%2FcatName%3E%3C%2Fmovie%3E%3C%2Fmovies%3E</a></p>
<p>Finally, my sample form also has a handy &#8220;URI Encoding Tool&#8221; section which you can use to encode various strings to include in a website address (as above).</p>
<h2>Samples</h2>
<p><a href="http://forms.stefcameron.com/samples/data-binding/CreateLoadDataNodes.pdf">Download Sample [pdf]</a></p>
<p><strong>Minimum Sample Requirements:</strong> I created this sample using Designer 8.2 and Acrobat 9 however it should work fine back to Acrobat 7.0.5.</p>
<p>There is also a great example on creating data nodes on page 438 of the <a href="http://www.adobe.com/go/learn_lc_scriptingReference_82">LiveCycle Designer ES Scripting Reference for Designer 8.2</a> &#8212; an excellent XFA form scripting reference.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/06/01/creating-and-loading-data-nodes/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Recording of AUC eSeminar on LiveCycle Designer</title>
		<link>http://forms.stefcameron.com/2009/02/13/recording-of-auc-eseminar-on-livecycle-designer/</link>
		<comments>http://forms.stefcameron.com/2009/02/13/recording-of-auc-eseminar-on-livecycle-designer/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:29:11 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/13/recording-of-auc-eseminar-on-livecycle-designer/</guid>
		<description><![CDATA[The recording of the Acrobat User Community eSeminar on Advanced Forms and LiveCycle Designer by Easel Solution&#8217;s Angie Okamoto is now available for viewing. Angie demonstrates advanced concepts in creating dynamic forms with LC Designer and you can also see all of the Q&#38;A comment threads between the attendees and the team of specialists answering [...]]]></description>
			<content:encoded><![CDATA[<p>The recording of the <a href="http://www.acrobatusers.com/">Acrobat User Community</a> eSeminar on <a href="http://www.acrobatusers.com/events/1343/advanced-forms-and-livecycle-designer">Advanced Forms and LiveCycle Designer</a> by Easel Solution&#8217;s Angie Okamoto is now <a href="http://adobechats.adobe.acrobat.com/p85974540/">available for viewing</a>. Angie demonstrates advanced concepts in creating dynamic forms with LC Designer and you can also see all of the Q&amp;A comment threads between the attendees and the team of specialists answering the questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/02/13/recording-of-auc-eseminar-on-livecycle-designer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New book: Acrobat and Designer Bible</title>
		<link>http://forms.stefcameron.com/2009/02/05/new-book-acrobat-and-designer-bible/</link>
		<comments>http://forms.stefcameron.com/2009/02/05/new-book-acrobat-and-designer-bible/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 21:57:24 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/02/05/new-book-acrobat-and-designer-bible/</guid>
		<description><![CDATA[Angie Okamoto, Director of Enterprise Development at Easel Solutions, and Ted Padova, the &#34;PDF Guru&#34; and author of the &#34;Adobe Acrobat PDF Bible&#34; series, have published a new book titled, &#34;PDF Forms Using Acrobat and LiveCycle Designer Bible&#34;. I&#8217;m sure it&#8217;ll be a great reference! Their book is available now on Amazon.com and Wiley.com.]]></description>
			<content:encoded><![CDATA[<p><img style="float: left; margin-right: 15px" alt="PDF Forms Using Acrobat and LiveCycle Designer Bible" src="http://forms.stefcameron.com/images/pdfforms-book-cover.jpg" />
<p><a href="http://www.wiley.com/WileyCDA/Section/id-302475.html?query=Angie+Okamoto">Angie Okamoto</a>, Director of Enterprise Development at <a href="http://www.techedsolutions.com/">Easel Solutions</a>, and <a href="http://www.wiley.com/WileyCDA/Section/id-302475.html?query=Ted+Padova">Ted Padova</a>, the &quot;PDF Guru&quot; and author of the &quot;Adobe Acrobat PDF Bible&quot; series, have published a new book titled, &quot;<strong>PDF Forms Using Acrobat and LiveCycle Designer Bible</strong>&quot;. I&#8217;m sure it&#8217;ll be a great reference!</p>
<p>Their book is available now on <a href="http://www.amazon.com/Forms-Using-Acrobatand-LiveCycle-Designer/dp/047040017X">Amazon.com</a> and <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-047040017X.html">Wiley.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/02/05/new-book-acrobat-and-designer-bible/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MAX 2008 Tutorial &#8211; Part 2 &#8211; Flex Code</title>
		<link>http://forms.stefcameron.com/2008/11/18/max-2008-tutorial-part2/</link>
		<comments>http://forms.stefcameron.com/2008/11/18/max-2008-tutorial-part2/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 13:00:14 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Form Guides]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/11/18/max-2008-tutorial-part-2-flex-code/</guid>
		<description><![CDATA[Welcome to the second in a three-part post series on importing data into a form guide (and, by extension, a PDF form). In the first part, we designed the XFA form that will provide us with the print/archive view of the movies retrieved from the Movie Service. The second part will focus on the special [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to the second in a three-part post series on importing data into a form guide (and, by extension, a PDF form). In the <a href="http://forms.stefcameron.com/2008/11/17/max-2008-tutorial-part1/">first part</a>, we designed the XFA form that will provide us with the print/archive view of the movies retrieved from the <a href="http://forms.stefcameron.com/services/movies/?help=1">Movie Service</a>. The second part will focus on the special Flex code we will need to include in the form which will ultimately be executed by Flash when it runs in the form guide which we&#8217;ll design in part 3.</p>
<h2>Flex Code in XFA Forms</h2>
<p>The key to today&#8217;s tutorial is understanding when and where the script you write in an XFA form (JavaScript or FormCalc) is compiled or interpreted.</p>
<p><span id="more-246"></span>
<p>For starters, form guides don&#8217;t support the FormCalc language so that just isn&#8217;t an option.</p>
<p>JavaScript, on the other hand, has the nice property of looking a lot like ActionScript. In fact, the two languages have enough similarities that with very little modification, any JavaScript you write in an XFA form can be converted into ActionScript which runs in a Flex form guide (in the Flash Player).</p>
<p>Normally, when you write JavaScript code in your forms and you run the form in Acrobat, the script isn&#8217;t compiled when the XFA form is converted into the PDF file format and it&#8217;s only interpreted when the interpreter attempts to execute it (i.e. if there&#8217;s a syntax error somewhere in your script and you never run that code, you&#8217;ll never know about the error). When you generate a form guide based on your form, however, your JavaScript is actually <strong>compiled by</strong> the <strong>Flex </strong>compiler that generates the SWC (Flash Library) which defines your form guide.</p>
<blockquote><p><span style="font-weight:bold;color:red">Warning: </span>Script object code seems to be loaded and interpreted by Acrobat in one shot, instead of on a per-access basis as in form object event scripts, and any syntax errors anywhere in the script object will cause all of the script in the script object to basically be ignored. If you have functions defined in a script object and you know you&#8217;re calling a function properly but you keep getting a &#8220;function is not defined&#8221; error, use the Script Editor&#8217;s Syntax Checker tool &#8212; you&#8217;ll probably find a syntax error somewhere. After you fix it, you should be able to access your script object functions.</p>
<p> It also appears that Acrobat/Reader 9.0 may now be attempting to parse (but not execute) <em>all</em> scripts on form load which may produce syntax errors in the JavaScript Console due to the differences between JavaScript and ActionScript syntax however in my experience so far, I haven&#8217;t hit a situation where my JavaScript stops executing because of this. Nonetheless, if you&#8217;re seeing strange behaviour, it might be a good idea to check the console to make sure things are running smoothly.</p></blockquote>
<p>What you might not have realized is that if you know that a particular portion of script will only be executed within the context of a form guide, you can actually <strong>write Flex code in your XFA form! </strong>When you generate the form guide (either by previewing using GuideBuilder or by rendering the form as a form guide via <a href="http://www.adobe.com/products/livecycle/forms/">LiveCycle Forms</a>), your Flex code will be compiled as any other Flex code would be and it&#8217;ll be executed in the same way.</p>
<p>That opens-up a world of possibilities and the one we&#8217;re going to explore in this tutorial is the use of the <a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/http/mxml/HTTPService.html">mx.rpc.http.HTTPService</a> class to fetch data from the Movie Service and insert the results into the Listing table within the form guide, thereby causing the data to be inserted into the Listing table within the PDF form when the user switches from the form guide to the PDF.</p>
<h2>XFA Host Name = Flash</h2>
<p>You might recall, in yesterday&#8217;s tutorial, that I talked about the <strong>xfa.host.name</strong> property returning &#8220;Flash&#8221; when your XFA code is executing within the context of a form guide (it returns &#8220;Acrobat&#8221; when its executed within the PDF because the form&#8217;s &#8220;host&#8221; is &#8220;Acrobat&#8221;).</p>
<p>This is the indicator we&#8217;ll use to &#8220;protect&#8221; the Flex code we&#8217;re going to write to make sure that it&#8217;s not executed within the PDF:</p>
<pre><code>if (xfa.host.name == "Flash")
{
    // do some cool stuff in Flex/ActionScript
}</code></pre>
<blockquote><p>Note that the <strong>XFA model in a form guide</strong> works just the same as it does within the PDF with the exception that the form guide environment only supports a <a href="http://help.adobe.com/en_US/livecycle/8.2/fgscriptsupport.pdf">subset of XFA functionality</a> (less than in the PDF but more than in HTML).</p></blockquote>
<h2>Our Own HTTPService</h2>
<p>Since there will 3 requests made to the Movie Service, one for the actor list, one for the category list and another for the movie listings resulting from the chosen actor and/or category (if any), the first step to take is to create some reusable code within our form that makes use of the HTTPService object.</p>
<p>Open the form you designed yesterday and add a new script object by right-clicking on the root subform (&#8220;movieList&#8221;) and choosing the &#8220;Insert Script Object&#8221; command.</p>
<p>Name your script object &#8220;FlexHttpService&#8221; and paste the code from <a href="http://forms.stefcameron.com/samples/max2008/Max2008-FlexHttpService.txt">this text file</a> into the script object.</p>
<p>You&#8217;ll notice that there are some statements in this script that aren&#8217;t regular JavaScript (namely the &#8220;import&#8221; statements to get access to the HTTPService and its result and fault event classes as well as the typing of variables like &#8220;service:HTTPService&#8221;). That&#8217;s because it&#8217;s ActionScript!</p>
<p>I&#8217;m assuming you know enough about Flex to be able to understand what&#8217;s going on but the gist of it is that the script object&#8217;s send() function takes a URL (to the Movie Service) and two functions, the first called when the request is successful and the second called if the request fails. If the request is successful, the result handler function is called with an XML variable as its parameter. This XML variable contains the movie listing we want to insert into the Listing table.</p>
<p>The FlexHttpService.send() function will be the reusable piece of code that we&#8217;ll use in the two listboxes and the button, each providing its own URL and result handlers.</p>
<blockquote><p>It&#8217;s important to note that the actual result and fault handlers given to the HTTPService object instance are <strong>inline functions</strong>. This is essential since the call to HTTPService.send() is <strong>asynchronous</strong>. When the result comes back (later), context will be lost and the service won&#8217;t be able to find a function you defined in the FlexHttpService script object. Therefore, the handlers must be inline.</p></blockquote>
<h2>ActorList Initialize Script</h2>
<p>With the FlexHttpService defined, it&#8217;s easier to write the rest of the code to fetch the <a href="http://forms.stefcameron.com/services/movies/?movie=0&amp;actor=0">list of actors</a>.</p>
<p>We want the list of actors to be retrieved when the form guide initializes so we&#8217;ll put this script in the Initialize event of the ActorList field. In the result handler, we&#8217;ll simply iterate through the items in the XML object returned and, for each actor, add his/her name and ID as an item into the ActorList field in the form guide.</p>
<p>Note that accessing the ActorList field in the form guide <strong>within the result handler</strong>, which is out-of-context at this point, is done by using the full SOM expression to the field, starting with <strong>xfa.form</strong> (accessing the Form DOM), followed by the root subform name (&#8220;movieList&#8221;), followed by the path to the ActorList field.</p>
<p>Edit the ActorList field&#8217;s Initialize event and paste the code from <a href="http://forms.stefcameron.com/samples/max2008/Max2008-ActorListInit.txt">this text file</a> into it.</p>
<p>Basically, we first clear any existing list items and call the Movie Service with the appropriate URL. In the result handler, we add items into the ActorList and then enable the list so that the user can make a selection (we don&#8217;t want the list accessible until the items have been loaded).</p>
<h2>CategoryList Initialize Script</h2>
<p>The CategoryList field is much the same as the ActorList field however it&#8217;ll fetch the <a href="http://forms.stefcameron.com/services/movies/?movie=0&amp;category=0">list of categories</a>.</p>
<p>Edit the CategoryList field&#8217;s Initialize event and paste the code from <a href="http://forms.stefcameron.com/samples/max2008/Max2008-CategoryListInit.txt">this text file</a> into it.</p>
<h2>GetMovies Click Script</h2>
<p>Finally, we just need to set the Click event script on the GetMovies button that will fetch the movies requested by the user (optionally filtering on actor and/or category).</p>
<p>This script is essentially the same as the first two however it&#8217;s a little more complex since the Listing table must be retrieved and then new instances of the MovieRow must be <a href="http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/">added</a> and their fields (Title, Actor, Category and Cost) populated with data from each movie returned from the service. Additionally, the button is disabled once its clicked and only re-enabled when the result or fault handler is called to prevent the user from clicking multiple times while a request is pending (since HTTPService.send() is asynchronous) and the MatchCount field is populated with the number of rows added to the Listing table (this will be important when we design the form guide in part 3).</p>
<p>Edit the GetMovies button&#8217;s Click event and paste the code from <a href="http://forms.stefcameron.com/samples/max2008/Max2008-GetMoviesClick.txt">this text file</a> into it.</p>
<h2>Solution to Part 2</h2>
<p>Try not to peek at this before you attempt to build the form on your own&#8230;</p>
<p><a href="http://forms.stefcameron.com/samples/max2008/Max2008-MovieCatalog-Part2.zip">Download Part 2 [zip]</a></p>
<p><strong>Minimum Requirements:</strong> The form should work back to Designer 8.0 however it was designed with Designer 8.2.1 SP1.</p>
<p class="postUpdate"><strong>Updated:</strong> November 22, 2008</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/11/18/max-2008-tutorial-part2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Book now available: Creating Dynamic Forms with Adobe LiveCycle Designer</title>
		<link>http://forms.stefcameron.com/2007/08/30/book-now-available-creating-dynamic-forms-with-adobe-livecycle-designer/</link>
		<comments>http://forms.stefcameron.com/2007/08/30/book-now-available-creating-dynamic-forms-with-adobe-livecycle-designer/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 12:47:50 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2007/08/30/book-now-available-creating-dynamic-forms-with-adobe-livecycle-designer/</guid>
		<description><![CDATA[That&#8217;s right: The day has finally come! Designer officially has its very first book on the market, thanks to J.P. Terry at SmartDoc Technologies. The book is the result of J.P.&#8217;s own expertise and&#160;a collaborative effort&#160;with the Designer Team in Ottawa. It&#160;tackles form design and techniques in&#160;building dynamic XML-based PDF forms with Designer. As Alan [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s right: The day has finally come! Designer officially has its very first book on the market, thanks to <a href="http://www.adobe.com/devnet/livecycle/articles/graph_effective_form_design_pt3.html">J.P. Terry</a> at <a href="http://www.smartdoctech.com/">SmartDoc Technologies</a>.</p>
<p><img src="http://forms.stefcameron.com/images/designer-book-cover.jpg"> </p>
<p>The book is the result of J.P.&#8217;s own expertise and&nbsp;a collaborative effort&nbsp;with the Designer Team in Ottawa. It&nbsp;tackles form design and techniques in&nbsp;building dynamic XML-based PDF forms with Designer.</p>
<p>As <a href="http://www.amazon.com/Alan-Siegel-Branding-Clear-Communications/dp/0979076641/ref=pd_bbs_sr_1/002-0743263-5124812?ie=UTF8&amp;s=books&amp;qid=1188313311&amp;sr=8-1">Alan Siegel</a> (Founder &amp; Chairman of <a href="http://www.siegelgale.com/">Siegel+Gale</a>, branding pioneer and champion of simplifying corporate communications)&nbsp;put it,</p>
<p>&#8220;J.P. Terry is a rare individual who understands both the design and technical issues involved with effective communications. This book will teach you about LiveCycle Designer but more importantly it will teach you about effective form design.&#8221;<br />
<h2>How to get the book</h2>
<p>The book is now available for immediate ordering at the following sites</p>
<ul>
<li><a href="http://www.peachpit.com/store/product.aspx?isbn=0321509870">PeachPit Press</a>
<li><a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780321509871&amp;itm=4">Barnes &amp; Noble</a></li>
</ul>
<p>as well as at various local bookstores.</p>
<p>For some reason, it&#8217;s still on &#8220;pre-order&#8221; status at <a href="http://www.amazon.com/Creating-Dynamic-Forms-LiveCycle-Designer/dp/0321509870/ref=sr_1_1/102-3863700-7455308?ie=UTF8&amp;s=books&amp;qid=1178140262&amp;sr=1-1">Amazon.com</a>&nbsp;but should be &#8220;officially&#8221; available shortly.</p>
<p>The Designer book&nbsp;will also be&nbsp;available for purchase at <a href="http://adobemax2007.com">MAX 2007</a>&nbsp;and I will be <strong>giving away a copy or two at my hands-on sessions</strong> on <a href="http://adobemax2007.com/na/sessions/">Designing PDF Forms and Flex-based Form Guides</a> so be sure to attend if you&#8217;re at <a href="http://www.adobemax2007.com/na/">MAX 2007 North America</a>!</p>
<h2>Sample Files Posted</h2>
<p>For those of you who already have the book, you can now download the <a href="http://www.smartdoctech.com/books.aspx">sample files from SmartDocTech.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/08/30/book-now-available-creating-dynamic-forms-with-adobe-livecycle-designer/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>It&#039;s almost here: A book on Designer!</title>
		<link>http://forms.stefcameron.com/2007/05/18/its-almost-here-a-book-on-designer/</link>
		<comments>http://forms.stefcameron.com/2007/05/18/its-almost-here-a-book-on-designer/#comments</comments>
		<pubDate>Sat, 19 May 2007 02:50:03 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2007/05/18/its-almost-here-a-book-on-designer/</guid>
		<description><![CDATA[I&#8217;ve lost count of how many times, over the past year, I&#8217;ve been asked if there was a good book on designing forms using LiveCycle Designer. Until now, the answer was always an unfortunate &#8220;no&#8221;. Well, I&#8217;m very happy to announce that J.P. Terry from SmartDoc Technologies has been hard at work over the past [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve lost count of how many times, over the past year, I&#8217;ve been asked if there was a good book on designing forms using <a href="http://www.adobe.com/products/server/adobedesigner/">LiveCycle Designer</a>. Until now, the answer was always an unfortunate &#8220;no&#8221;.</p>
<p>Well, I&#8217;m very happy to announce that <a href="http://www.adobe.com/devnet/livecycle/articles/graph_effective_form_design_pt3.html">J.P. Terry</a> from <a href="http://www.smartdoctech.com/">SmartDoc Technologies</a> has been hard at work over the past few months on a book titled, <a href="http://www.amazon.com/Creating-Dynamic-Forms-LiveCycle-Designer/dp/0321509870/ref=sr_1_1/102-3863700-7455308?ie=UTF8&#038;s=books&#038;qid=1178140262&#038;sr=1-1">Creating Dynamic Forms with Adobe LiveCycle Designer</a>.</p>
<p>Based on some of the chapters I&#8217;ve reviewed so far, this is going to be an excellent resource for those of you who might not know where to start or perhaps would like a few pointers on good form design. I, for one, am really excited about this since it&#8217;s the first (of hopefully many more to come) book about the product and technologies I work on every day. It&#8217;s almost like a milestone &#8212; Designer&#8217;s first book.</p>
<p>No word yet on a specific release date but I&#8217;ll keep you all posted as I get more details over the coming months.</p>
<p>So how about you? Are you looking forward to a book on Designer and dynamic forms?</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/05/18/its-almost-here-a-book-on-designer/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Instance Manager Object Reference</title>
		<link>http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/</link>
		<comments>http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/#comments</comments>
		<pubDate>Sat, 11 Nov 2006 17:12:08 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Instance Manager]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=55</guid>
		<description><![CDATA[It seems lately a lot of my posts and a lot of the comments that you&#8217;ve posted had something to do with the Instance Manager: The object available only on repeatable (dynamic) subforms which allows you to manage that subform&#8217;s instances (add, remove, etc.). Since it&#8217;s at the core of repeatable subforms which are necessary [...]]]></description>
			<content:encoded><![CDATA[<p>It seems lately a lot of my posts and a lot of the comments that you&#8217;ve posted had something to do with the Instance Manager: The object available only on repeatable (dynamic) subforms which allows you to manage that subform&#8217;s instances (add, remove, etc.).</p>
<p>Since it&#8217;s at the core of repeatable subforms which are necessary when designing flowable (dynamic) forms that, say, display one row per record in a table connected to a database, I thought it would be useful to give a quick overview of the Instance Manager Object&#8217;s properties and methods.</p>
<h2>Accessing the Instance Manager</h2>
<p>Before we get to the properties and methods, here&#8217;s a refresher on how to get at the Instance Manager for a particular subform (or table row).</p>
<h3>Repeatable Subform Required </h3>
<p>First, you must make the subform <em>repeatable</em>. To make it repeatable, it must be placed in a <strong>flowed</strong> container &#8212; that is, another subform whose Content type (found on the Object palette&#8217;s Subform tab) is set to <em>flowed</em>.</p>
<blockquote>
<p> <strong>Side Note:</strong> The simplest case is a report-style form that simply displays records from a database where each record&#8217;s information is displayed in separate fields within a subform. So you have a subform with fields in it that are bound to data nodes in some <a href="http://forms.stefcameron.com/category/data-binding/">data connection</a> and the subform itself is bound to a repeating data section in that same data connection. For this scenario, you&#8217;ll find it much easier to place your fields on the first page and then shrink the page (which is a subform) such that it&#8217;s snug against the fields you placed on it and looks more like a row rather than a page. This is because the page subforms are, by definition, subforms parented to the root subform (named &quot;form1&quot; by default on new forms &#8212; check it out at the top of the Hierarchy palette) and the root subform is, by definition, <strong>flowed</strong>. By using the page subform as your repeatable subform for your data records, you&#8217;ll find it much easier to quickly get to a state where all records show-up on your form and new pages get added when previous ones are full (can&#8217;t fit any more rows).</p>
</blockquote>
<p>Once the subform is placed in a flowed container (parent subform), you must then specify that it&#8217;s a <strong>repeatable</strong> subform by going to the Binding tab on the Object palette and checking the &quot;Repeat subform for each data item&quot; box.</p>
<p>After these two easy steps are complete, you&#8217;ll then automagically get an Instance Manager object on the repeatable subform you just defined.</p>
<h3>Script Access</h3>
<p>It&#8217;s nice to have a repeatable subform but unless you&#8217;re just using the default behaviour (which may very well be just fine in most cases), you&#8217;ll need to write scripts that use it&#8217;s Instance Manager&#8217;s properties and methods and you&#8217;ll need to know how to access the Instance Manager in your scripts.</p>
<p>It turns out there are two ways of doing this:</p>
<ol>
<li><strong>instanceManager Property: </strong>As long as you have at least one existing instance of the repeatable subform, you can access its instanceManager object directly like you would any other property: <strong>RepeatableSubform.instanceManager</strong>. Note, however, that this property will only be accessible if at least one instance of the RepeatableSubform object exists (which could be a problem if you&#8217;ve specified that its minimum allowed number of instances is zero and its initial instance count is zero as well).</li>
<li><strong>Underscore Prefix: </strong>The other <strong>recommended</strong> way to access a repeatable subform&#8217;s Instance Manager is to use, for lack of a better term, &quot;the underscore-prefixed repeatable subform name&quot; object. That is, whenever a subform becomes repeatable, its Instance Manager is added to the Script Object Model as a child of the subform&#8217;s parent container (remember, that&#8217;s the flowed subform from earlier) and is given a name that is the repeatable subform&#8217;s name with a &quot;_&quot; prefix. Therefore, if your subform was named &quot;RepeatableSubform&quot;, its Instance Manager would get a name of &quot;_RepeatableSubform&quot; and you would access it as a property of the flowed container subform like this:<strong> FlowedContainerSubform._RepeatableSubform</strong>. The nice thing about accessing it this way is that you always have access to it &#8212; even if no instances of the RepeatableSubform object currently exist. </li>
</ol>
<h2>Properties and Methods </h2>
<p>Now that you know how to make a subform repeatable and get access to its Instance Manager object when writing scripts, here are the various properties and methods that you have access to:</p>
<h3>Properties</h3>
<ul>
<li><strong>count: </strong>Returns the number of instances that currently exist. This is very useful when writing loops that do something to each instance.</li>
<li><strong>min: </strong>Returns the minimum allowed number of instances. When removing instances, you&#8217;ll get a scripting error if the resulting number of instances is less than the minimum and the minimum number of instances will still remain (even if you meant to remove them). This can be set using the Min property on the Binding tab of the Object palette or my accessing the subform&#8217;s &quot;occur&quot; element and setting its min property: RepeatableSubform.occur.min = &quot;value&quot;.</li>
<li><strong>max:</strong> Returns the maximum allowed number of instances. When adding instances, you&#8217;ll get a scripting error if the resulting number of instances is more than the maximum and no additional instances will be added. You can modify this in the Object palette&#8217;s Binding tab or with the following property: RepeatableSubform.occur.max = &quot;value&quot;.</li>
<li><strong>occur:</strong> This is a reference to the pertaining subform&#8217;s &amp;lt;occur&amp;gt; element which lets you modify its minimum (min), maximum (max) and initial (initial) number of instances.</li>
<li><strong>name:</strong> This property sets the name of the Instance Manager object itself. I doubt this would ever really be useful but it&#8217;s a property nonetheless. <strong>Be forewarned</strong>, however, that it&#8217;ll affect all subsequent scripts. For example, if you were to write &quot;FlowedContainer._RepeatableSubform.name = &#8216;myIM&#8217;;&quot; and then write &quot;FlowedContainer._RepeatableSubform.addInstance(0);&quot;, you would get a an error stating that &quot;_RepeatableSubform&quot; doesn&#8217;t exist. That&#8217;s because you&#8217;ve changed its name to &quot;myIM&quot; and therefore should write &quot;FlowedContainer.myIM.addInstance(0);&quot;.</li>
</ul>
<h3>Methods</h3>
<ul>
<li><strong>addInstance(bool merge):</strong> Adds a new instance of the repeatable subform and returns a reference to the new instance (or <em>null</em> if no instance was added) . <a href="http://forms.stefcameron.com/2006/07/08/demystifying-imaddinstance/">Setting <em>merge</em> to 1</a> will cause any additional data to be merged with the new instance. Also, don&#8217;t forget that <a href="http://forms.stefcameron.com/2006/05/20/add-recalculate/">new instances aren&#8217;t automatically added to the form&#8217;s calculation dependencies</a>. Also, be careful not to add more than the maximum number of allowed instances (see the <strong>max</strong> property).</li>
<li><strong>removeInstance(int index): </strong>Removes the instance with the specified zero-based <em>index</em>. <span style="color: green; font-weight: bold;">[A/R 7.x]</span> You may need to <a href="http://forms.stefcameron.com/2006/05/25/remove-remerge/">call xfa.form.remerge() after removing an instance</a>. Also, be careful not to remove more than the minimum number of allowed instance (see the <strong>min</strong> property). <span style="color: green; font-weight: bold;">[A/R 8.1+]</span> If there’s anything else you need to do (any other script statements) along with removing an instance, make sure that the instance is removed <em>once all other statements have been executed</em>. The new Direct Rendering engine in A/R 8.1 removes the instance, and all objects that it contains, immediately (as opposed to removing it on the next rendering pass as in previous versions) which means that any subsequent statements are not executed.</li>
<li><strong>moveInstance(int fromIndex, int toIndex): </strong>Moves the instance at the zero-based <em>fromIndex</em> such that it becomes the instance at the zero-based <em>toIndex</em> (and other instance in between are shifted up/down as necessary).</li>
<li><strong>insertInstance(int position [, bool merge = 0]):</strong> <span style="color: green; font-weight: bold;">[New in A/R 8.0]</span> Inserts a new instance at the zero-based <em>position</em> specified and returns a reference to the new instance (or <em>null</em> if no instance was added). You may optionally specify 0 or 1 for the <em>merge</em> property which, if set to 1, will merge any additional data with the new instance. The same rules and gotchas apply for this method as they do for the <strong>addInstance</strong> method described above.</li>
<li><strong>setInstances(int count): </strong>Adds or removes instances to/from the end of the set depending on the difference between the current instance count and the specified instance count. In other words, if there are currently 4 instances and you call &quot;setInstances(6)&quot;, two new instances will be added to the end of the set. Conversely, if 3 instances exist and you call &quot;setInstances(2)&quot; the last instance in the set will be removed. Note that this method abides by the currently-specified <strong>min</strong> and <strong>max</strong> restrictions.</li>
</ul>
<h2>Recommended Scripting Language</h2>
<p>On a last note, I simply wanted to recommend using <strong>JavaScript</strong> as opposed to <strong>FormCalc</strong> when scripting the Instance Manager &#8212; especially when adding or removing instances. While FormCalc technically fully supports the Instance Manager, I personally find it&#8217;s a little flakey. JavaScript support, however, is quite consistent and stable.</p>
<p class="postUpdate"><strong>Updated:</strong> June 26, 2009</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2006/11/11/instance-manager-object-reference/feed/</wfw:commentRss>
		<slash:comments>117</slash:comments>
		</item>
	</channel>
</rss>

