<?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; Bugs</title>
	<atom:link href="http://forms.stefcameron.com/category/bugs/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>Multi-Selection List Schema Definition</title>
		<link>http://forms.stefcameron.com/2009/09/30/multi-selection-list-schema-definition/</link>
		<comments>http://forms.stefcameron.com/2009/09/30/multi-selection-list-schema-definition/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 14:07:02 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/09/30/multi-selection-list-box-schema-definition/</guid>
		<description><![CDATA[After spending some time, recently, showing you how to connect your form to a schema and highlighting Designer&#8217;s support for schema metadata, I thought I would round-off my current train of thought on schemas by tackling multi-selection listboxes. Since they store their selected data in &#60;value&#62; nodes, once you think about it, their schema definition [...]]]></description>
			<content:encoded><![CDATA[<p>After spending some time, recently, showing you how to <a href="http://forms.stefcameron.com/2009/08/03/connecting-to-a-schema/">connect your form to a schema</a> and highlighting Designer&#8217;s support for <a href="http://forms.stefcameron.com/2009/08/28/schema-metadata/">schema metadata</a>, I thought I would round-off my current train of thought on schemas by tackling multi-selection listboxes. Since they store their selected data in &lt;value&gt; nodes, once you think about it, their schema definition may not be obvious. When you&#8217;re working with XML data that isn&#8217;t governed by a schema and namespaces, it is perhaps easier to work with (i.e. accept) these &lt;value&gt; nodes however things change when you have a schema telling you how your data must be structured and scoped (with namespaces).</p>
<p><span id="more-449"></span><br />
<h2>How Lists Store Selected Items</h2>
<p>To better understand the challenges, let&#8217;s look at how list form objects store a multi-selection of values.</p>
<p>In the <strong>Form DOM</strong>, the list&#8217;s value actually contains XML rather than plain text. For example, say we have a multi-selection list named &#8220;ListBox1&#8243; (bound to a data element named &#8220;list1&#8243;) with items (&#8220;item1&#8243;, &#8220;item2&#8243;, &#8220;item3&#8243;). If the first two items were selected, the list&#8217;s value would look like this:</p>
<pre><code>&lt;value&gt;
    &lt;exData contentType="text/xml"&gt;
        &lt;list1&gt;
            &lt;value&gt;item1&lt;/value&gt;
            &lt;value&gt;item2&lt;/value&gt;
        &lt;/list1&gt;
    &lt;/exData&gt;
&lt;/value&gt;</code></pre>
<p>In <strong>script</strong>, this would translate to a newline (\n)-delimited string when the list&#8217;s value is accessed from its rawValue property:</p>
<pre><code>item1\nitem2</code></pre>
<p>In the <strong>Data DOM</strong>, the list&#8217;s value is stored in a series of repeating &lt;value&gt; nodes, much like the way it is stored in the Form DOM:</p>
<pre><code>&lt;list1&gt;
    &lt;value&gt;item1&lt;/value&gt;
    &lt;value&gt;item2&lt;/value&gt;
&lt;/list1&gt;</code></pre>
<h2>Adding the Schema</h2>
<p>A schema describes how XML should be structured. Given how lists store their selected items in data, a schema that includes a multi-selection list will need to allow for the element that defines the list to contain zero or more repeating &lt;value&gt; nodes. Unfortunately, this means modifying your schema, if you already have one. (I can think of at least one workaround to this which would involve script and a sibling, hidden text field bound to the element in your schema, as opposed to the list itself, in which you would store the selection, but I won&#8217;t get into that in this article.)</p>
<p>For example, <a href="http://forms.stefcameron.com/samples/data-binding/schema-multisellist/multiSelList-schema.xsd">this</a> is a schema that defines a &#8220;form1&#8243; root element that contains an element named &#8220;list1&#8243; that has a multi-selection list type (the way XFA expects it).</p>
<h3>Data Connection</h3>
<p>The problem with this structure is that once you connect your form to this schema, the Data View connection tree will interpret the list1 element as being a subform that contains a repeating node, &#8220;value&#8221;:</p>
<p><img src="http://forms.stefcameron.com/images/SchemaMultiSelList/SchemaMultiSelList-1.jpg"> </p>
<p>Because of this interpretation, you cannot simply drag &amp; drop the &#8220;list1&#8243; schema element into your form in order to get a multi-selection list. Instead, you&#8217;ll get a subform with a text field inside of it instead (only an element with a simple type restricted to an enumeration of values would be interpreted as a list). Furthermore, you cannot use the picker widget next to the &#8220;Object palette &gt; Binding tab &gt; Data Binding property&#8221; to assign &#8220;list1&#8243; to a listbox you have already dragged into your form from the Object Library palette because &#8220;list1&#8243; is viewed as a container (subform) and the form object you are attempting to bind is a field.</p>
<h3>Data Binding</h3>
<p>In order to bind the listbox to the &#8220;list1&#8243; schema element, you must manually type its binding expression into the &#8220;Object palette &gt; Binding tab &gt; Data Binding property&#8221;. For our simple use case, <strong>the binding is &#8220;list1&#8243;</strong>. Note that you don&#8217;t actually bind the repeating &#8220;value&#8221; element to anything and that the schema data connection tree will not actually indicate that the &#8220;list1&#8243; element is bound to a form object even though it now is (I&#8217;m guessing this is because it is expecting &#8220;list1&#8243; to be bound to a subform, not a field).</p>
<p>The result of binding the listbox to the &#8220;list1&#8243; schema element is that the Form DOM output changes slightly to include the proper namespace on the bound element within the field&#8217;s value:</p>
<pre><code>&lt;value&gt;
    &lt;exData contentType="text/xml"&gt;
        &lt;scof:list1 xmlns:scof="http://forms.stefcameron.com/ns/2009/"&gt;
            &lt;value&gt;item1&lt;/value&gt;
            &lt;value&gt;item2&lt;/value&gt;
        &lt;/scof:list1&gt;
    &lt;/exData&gt;
&lt;/value&gt;</code></pre>
<h2>Submitting Data</h2>
<p>As you might expect, given the structure of the listbox&#8217;s selection in the Form DOM above, the list&#8217;s selection data will be similar in the Data DOM (which is what would be submitted from the form as well):</p>
<pre><code>&lt;xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"&gt;
    &lt;scof:form1 xmlns:scof="http://forms.stefcameron.com/ns/2009/"&gt;
        &lt;scof:list1&gt;
            &lt;value&gt;item1&lt;/value&gt;
            &lt;value&gt;item2&lt;/value&gt;
        &lt;/scof:list1&gt;
    &lt;/scof:form1&gt;
&lt;/xfa:data&gt;</code></pre>
<p>The only problem with the data above is that it isn&#8217;t valid against the schema which specifies that the repeating &lt;value&gt; nodes inside the list1 element are part of the &#8220;scof&#8221; (target) namespace and should therefore look like &lt;scof:value&gt;.</p>
<h2>Submitting Namespaced Data</h2>
<p>In order to get the namespace into the repeating &lt;value&gt; nodes for the selected values, we have to use a workaround that involves a little script in the listbox&#8217;s Exit event (though the script could be triggered elsewhere, if you like):</p>
<pre><code>// JavaScript:

// schema namespace info
var nspace = "scof";
var nsUri = "http://forms.stefcameron.com/ns/2009/";

// get selection from list
var selection = this.rawValue.split("\n");

// build XML string for new selection in *Form DOM*
//  that includes the namespace in the &lt;value&gt;
//  nodes the outer &lt;listSelection&gt; node is
//  essentially irrelevant and will be discarded later
//  however it is required so that we can load its
//  content into the listbox's exData value node where
//  its value is set in the Form DOM
// this.dataNode.name gets the listbox's bound data
//  element name from the Data DOM which is required
//  in the XML
var newSelection = "&lt;listSelection&gt;\n&lt;" + nspace +
    ":" + this.dataNode.name + " xmlns:" + nspace +
    "='" + nsUri + "'&gt;";

// add selected items into the new selection -- take
//  note of the newline character at the beginning of
//  the string as it is critical to the XML loading
//  properly later on (it shouldn't be but it is...)
for (var i = 0; i &lt; selection.length; i++)
{
    newSelection += "\n&lt;" + nspace + ":value&gt;" +
        selection[i] + "&lt;/" + nspace + ":value&gt;";
}

// close the XML elements in the string
newSelection += "\n&lt;/" + nspace + ":" +
    this.dataNode.name + "&gt;\n&lt;/listSelection&gt;";

// load the new namespaced selection into the listbox's
//  exData value node, ignoring the root &lt;listSelection&gt;
//  node in the XML string
this.value.exData.loadXML(newSelection, true, true);</code></pre>
<p>The script above essentially builds an XML string equivalent in structure to that which is normally used to store the list&#8217;s selection in the Form DOM however it adds the necessary namespaces to the repeating &lt;ns:value&gt; nodes. This change is then replicated in the list1 data node in the Data DOM and the form&#8217;s exported data changes to this (which can be successfully validated against the schema we&#8217;re using):</p>
<pre><code>&lt;xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"&gt;
    &lt;scof:form1 xmlns:scof="http://forms.stefcameron.com/ns/2009/"&gt;
        &lt;scof:list1&gt;
            &lt;scof:value&gt;item1&lt;/scof:value&gt;
            &lt;scof:value&gt;item2&lt;/scof:value&gt;
        &lt;/scof:list1&gt;
    &lt;/scof:form1&gt;
&lt;/xfa:data&gt;</code></pre>
<h3><a name="warning"></a>Import Data Warning</h3>
<p>Unfortunately, I have to point-out a bug as it relates to exporting multi-selection values with namespaces (which you only get when you use the above workaround script): Importing data with namespaced &lt;ns:value&gt; nodes for multi-selection lists &#8212; though valid XML and valid against the schema &#8212; will fail in Acrobat 9.1.3 (I have not done any testing on previous versions). My testing has revealed that the form doesn&#8217;t render properly after the data merge. Importing namespaced data that does not have namespaced &lt;value&gt; nodes for multi-selection lists, however, does work fine (this is the default way data is exported, unless you use the script I outlined above).</p>
<h2>Sample Form</h2>
<p>I have built a sample form that demonstrates how multi-selection lists store their data in the Form DOM and Data DOM. The form also includes a checkbox which, when checked, will generate namespaced &lt;ns:value&gt; nodes instead of the default &lt;value&gt; nodes, using the workaround script in the list&#8217;s Exit event.</p>
<p>Download:</p>
<ul>
<li><a href="http://forms.stefcameron.com/samples/data-binding/schema-multisellist/SchemaMultiSelList.pdf">Form [pdf]</a>
<li><a href="http://forms.stefcameron.com/samples/data-binding/schema-multisellist/multiSelList-schema.xsd">Schema [xsd]</a>
<li><a href="http://forms.stefcameron.com/samples/data-binding/schema-multisellist/sampleData.xml">Sample Data [xml]</a>
<li><a href="http://forms.stefcameron.com/samples/data-binding/schema-multisellist/sampleData-ns.xml">Sample Data (namespaced) [xml]</a></li>
</ul>
<p><strong>Minimum Requirements:</strong> I designed this form using Designer ES2 Beta and Acrobat 9.1.3 however the form should work all the way back to Designer 7.1 and Acrobat 7.0.5.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/09/30/multi-selection-list-schema-definition/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>LiveCycle Designer 8.2 Update</title>
		<link>http://forms.stefcameron.com/2009/03/17/livecycle-designer-82-update/</link>
		<comments>http://forms.stefcameron.com/2009/03/17/livecycle-designer-82-update/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 13:18:09 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[LiveCycle]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/17/livecycle-designer-82-update/</guid>
		<description><![CDATA[I wasn&#8217;t sure I could actually blog about this update due to licensing issues but hey, they just did on the LiveCyle Blog. I guess it&#8217;s all in the wording. In particular, this 8.2.1 SP2 update resolves a nasty bug where your form would grow to multiple megabytes in size due to a processing instruction [...]]]></description>
			<content:encoded><![CDATA[<p>I wasn&#8217;t sure I could actually blog about this update due to licensing issues but hey, <a href="http://blogs.adobe.com/livecycle/2009/03/post.html">they just did</a> on the LiveCyle Blog. I guess it&#8217;s all in the wording.</p>
<p>In particular, this 8.2.1 SP2 update resolves a nasty bug where your form would grow to multiple megabytes in size due to a processing instruction (PI) being repeated thousands of times for a particular field. The PI looks like this (though the value, &#8216;aped3&#8242;, may differ):</p>
<pre><code>&lt;?templateDesigner StyleID aped3?&gt;</code></pre>
<p>Thankfully, this bug doesn&#8217;t occur often but when it does, the most common symptoms are:</p>
<ol>
<li>reduced performance when working in Designer;
<li>form file bloat (into the multiple MBs); and
<li>crashes when working in Designer with the form open.</li>
</ol>
<p>If you can&#8217;t update Designer due to your licensing agreement and you come across this bug, you&#8217;ll need to go to the XML Source and look for a processing instruction like the one quoted above. It&#8217;ll be there many, many times. Just delete all occurrences. If your form is saved as an XDP, then you can exit Designer and open it in Notepad (or some other text editor) and delete it that way as well. Then re-open it in Designer.</p>
<p class="postUpdate"><strong>Updated:</strong> March 28, 2009</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/03/17/livecycle-designer-82-update/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>MAX 2008 Tutorial &#8211; Part 3 &#8211; Form Guide</title>
		<link>http://forms.stefcameron.com/2008/11/19/max-2008-tutorial-part3/</link>
		<comments>http://forms.stefcameron.com/2008/11/19/max-2008-tutorial-part3/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 13:00:53 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Form Guides]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tables]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/11/19/max-2008-tutorial-part-3-form-guide/</guid>
		<description><![CDATA[Welcome to the third and final part of a three-part post series tutorial on importing data into a form guide and a PDF. The first part covered the form design, the second part covered the Flex code and the third part will cover designing and debugging the form guide that will complete the solution. Form [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to the third and final part of a three-part post series tutorial on importing data into a form guide and a PDF. The <a href="http://forms.stefcameron.com/2008/11/17/max-2008-tutorial-part1/">first part</a> covered the form design, the <a href="http://forms.stefcameron.com/2008/11/18/max-2008-tutorial-part2/">second part</a> covered the Flex code and the third part will cover designing and debugging the form guide that will complete the solution.</p>
<h2>Form Guide Layout</h2>
<p>The goal is to design a form guide which will provide two panels: one for user options and the other for results.</p>
<p>The first panel will expose the 4 fields inside the GuideObjects subform (which are only meant to be exposed in the form guide &#8212; hence why the GuideObjects subform has the Initialize script to hide it if the host isn&#8217;t &#8220;Flash&#8221;). The user will have the option to choose an actor and/or category for further filtering and will then click on the GetMovies button to execute the request on the <a href="http://forms.stefcameron.com/services/movies/?help=1">Movie Service</a>. When the requested XML is returned to the form guide, the GetMovies result handler will convert the XML into instances of MovieRow inside the Listing table.</p>
<p>The second panel will use a <strong>repeater layout</strong> to expose the Listing table&#8217;s contents within the form guide however this panel will only be accessible if the movie query returned 1 or more results.</p>
<p>Once the results are in, the user will then be able to switch (&#8220;flip&#8221;) to the PDF view which will show the Listing table in the form, from which the user could then print or archive the results.</p>
<p><span id="more-264"></span><br />
<h2>Designing the Form Guide</h2>
<p>Open your tutorial form in Designer and launch GuideBuilder (GB) by choosing the &#8220;Tools &gt; Create or Edit Form Guide&#8221; command. Switch to the &#8220;Customize Appearance&#8221; tab and choose &#8220;Save Styles&#8221;, saving them to a SWC file of your choice (usually in the same folder). It&#8217;s not mandatory to do this but if you don&#8217;t specify a file name here, GB will auto-generate a style SWC (which contains information about any style customizations you might apply) named according to the wrapper you choose (e.g. &#8220;ga.wrappers.CobaltStandard.swc&#8221; for the &#8220;Cobalt Standard&#8221; wrapper &#8212; not the most meaningful name for our solution).</p>
<p>Back to the &#8220;Edit Guide&#8221; tab, set the guide&#8217;s title to &#8220;MAX 2008 Movie Catalog Service&#8221; (double-click on the &#8220;New Guide&#8221; label to set it), the section&#8217;s title to &#8220;Movie Catalog&#8221; and the panel&#8217;s title to &#8220;Options&#8221;. Set the panel&#8217;s layout to &#8220;Two Column&#8221;.</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-1.Png"></p>
<h3>Options Panel</h3>
<p>Click on the &#8220;Add or Bind Fields&#8221; button and drag the entire GuideObjects subform into the panel. You&#8217;ll see, in the &#8220;Panel Preview&#8221; pane on the lower-right, that objects in the panel are laid-out in two columns from left to right, top to bottom, according to the top-down order in which they appear in the panel. What we want is for the MatchCount field to show-up <em>below</em> the GetMovies button. To do this, insert a &#8220;Next Area&#8221; object (from the &#8220;Utility Objects&#8221; group at the top of the form tree) after all the objects in the panel and then drag the MatchCount field below it. The &#8220;Next Area&#8221; object causes a break in the layout algorithm, thereby forcing the following object onto the next row in the two-column layout.</p>
<p>To make the panel layout more pleasing, switch back to the &#8220;Set Properties&#8221; view and set the captions of the ActorList, CategoryList and MatchCount fields to be at the top and the width of both listboxes to be &#8220;100%&#8221;. Finally, override the MatchCount field&#8217;s caption (double-click on it) and set it to &#8220;Number of movies matching criteria:&#8221; (accept the warning about the caption binding being removed).</p>
<blockquote><p>One important form guide feature is the ability to display fields in different ways. In other words, if your field is a listbox, for example, you aren&#8217;t limited to displaying it as a traditional listbox. You could choose to display it as a series of checkboxes or radio buttons, for example, or you could create your own custom control using FlexBuilder.</p></blockquote>
<p>GB provides a checkbox control type which will suit our needs perfectly because while our listboxes are single-selection only, using checkboxes will allow the user to remove a previous selection which is important if they previously filtered by actor, for instance, and now they want to remove that filter.</p>
<p>For the ActorList and CategoryList fields, set their &#8220;Display field as a&#8221; property to &#8220;Check Boxes&#8221;.</p>
<p>At this point, the settings for the ActorList (and CategoryList) fields should look like this:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-2.Png"></p>
<p>and your form guide hierarchy should look like this:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-3.Png"></p>
<h3>Movie Listings Panel</h3>
<p>The second panel is a lot simpler since it just shows the Listing table&#8217;s contents and it doesn&#8217;t require as much settings.</p>
<p>Insert a second panel into the &#8220;Movie Catalog&#8221; section, give it a title of &#8220;Movie Listings&#8221; and set its layout to be &#8220;Repeater Grid&#8221;.</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-4.Png"></p>
<p>The objects named &#8220;Repeater First Column&#8221; and &#8220;Repeater Second Column&#8221; don&#8217;t apply to this type of repeater panel however they do matter in other repeater layouts and are there for consistency (should you decide to change the repeater panel type). The &#8220;Trailer&#8221; object signifies that all objects placed after it, on this panel, will go <em>below</em> the grid as opposed to being part of the grid (this would be good for footer objects, if we had any).</p>
<p>Drag the MovieRow subform (table row) into the panel <strong>between</strong> the &#8220;Repeater First Column&#8221; and &#8220;Repeater Second Column&#8221; objects (drop the subform directly in between the two objects &#8212; if you miss, just drag each object back to where it&#8217;s supposed to go).</p>
<p>For each field you dragged-in, set its caption as follows: &#8220;Title&#8221;, &#8220;Actor&#8221;, &#8220;Category&#8221; and &#8220;Cost&#8221;. (You should see these changes in real-time in the Panel Preview pane.) Select the Title item and set its width to 150 (which means pixels in the form guide) to ensure the titles are completely visible and then set its &#8220;<strong>Allow field to repeat</strong>&#8221; property to indicate that it, and all associated fields, should be repeated within the grid layout. The items in the panel will then get a yellow outline indicating that they are repeating items.</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-5.Png"></p>
<p>Now that we&#8217;ve set this up, I&#8217;ll follow-up on a comment I made in part 1 when we designed the Listing table and set the MovieRow to have 1 initial instance: There&#8217;s a <strong>bug in the Repeater Grid </strong>panel layout where the data entered into the fields in the grid will not be rendered (it&#8217;s there, you just can&#8217;t see it) unless there&#8217;s some data in the grid when the form guide is initialized. To work around the bug, we simply include an initial instance of the MovieRow and then the GetMovies result handler code simply removes the instance prior to populating the table with movie results (whether there are any or not).</p>
<p>The last step in setting-up this panel is to apply a <strong>Display Rule</strong> to indicate when the panel should be visible (accessible to the user) in the form guide. What we want to do is set the panel to be visible only if the MatchCount field&#8217;s value is greater than zero, meaning there&#8217;s at least one movie result from the query. To do this, you simply toggle the &#8220;Specify panel display rules&#8221; pane in the panel&#8217;s properties, choose &#8220;Use Display Rules&#8221;, add a rule, set MatchCount as the field, &#8220;greater than&#8221; as the condition and &#8220;0&#8243; as the value.</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-6.Png"></p>
<h2>FormBridge XFO Fix</h2>
<p>Now that the form guide has been designed, the<br />
re&#8217;s just one more thing we need to do: Apply a small fix to the FormBridge code that brokers the communication between the form guide and the PDF at runtime. The FormBridge code is normally automatically injected into the PDF when it&#8217;s generated by the GB Preview functionality or by LiveCycle when the form is rendered as a form guide with the PDF however we need to use our own &#8220;fixed&#8221; version of the FormBridge code. Otherwise, when we flip to the PDF, <strong>there will be no data in the table.</strong></p>
<p>To do this, save your changes to the form guide and exit GB. Find the &#8220;Custom&#8221; pane in Designer&#8217;s Object Library and drag the &#8220;Form Bridge&#8221; object onto your form <strong>below</strong> the GuideObjects subform (where there are no objects on the page).</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-7.Png"></p>
<p>It shows-up as a hairline selection on the page and in the hierarchy looks like this:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-8.Png"></p>
<p>Select the &#8220;ContainerFoundation_JS&#8221; script object and open the Script Editor to edit the script. Find the two instances of &#8220;saveXML()&#8221; (lines 316 and 631) using the Find dialog (Ctrl + F) and change them from</p>
<pre><code>saveXML().replace(/\n/g, "");</code></pre>
<p>to</p>
<pre><code>saveXML();</code></pre>
<p>Do not remove/change any of the code that comes before it on the same line. This fix ensures that the format of the data going across the line is correct.</p>
<p>With the FormBridge object in our form, GB Preview and LiveCycle will not inject their version into the PDF. The only draw-back from this approach is that if the FormBridge code changes, you&#8217;ll have to manually update it in your form as opposed to automatically getting the new version when you preview with GB or render your form with LiveCycle.</p>
<p>This bug should be fixed in a future release and so the workaround in the FormBridge code will eventually no longer be needed.</p>
<h2>Flash Log and Debug Players (Optional)</h2>
<p>You may have noticed some &#8220;trace()&#8221; statements in the code we set on the ActorList, CategoryList and GetMovies objects in part 2. This is a handy way to get a read on what&#8217;s going on (i.e. debugging) inside the form guide at runtime if you aren&#8217;t using FlexBuilder to debug it (which we&#8217;re trying to avoid in this tutorial). It&#8217;s a lot like using &#8220;console.println()&#8221; to output information to Acrobat&#8217;s JavaScript Console.</p>
<p>If you want to see trace statement outputs (it&#8217;s not necessary but it could be handy), you need to look at your flashlog.txt file which is auto-generated by the <strong>debug</strong> version of the Flash Player. These are normally called &#8220;debug players&#8221; or &#8220;content debuggers&#8221; and are <a href="http://www.adobe.com/support/flashplayer/downloads.html">downloadable here</a>. To ensure that you have a debug player, you can hit <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19245&amp;sliceId=1">this page</a> which will tell you what version and type of Flash Player your browser is using.</p>
<p>Once you&#8217;ve installed a debug player, you&#8217;ll need to configure your system to enable the flashlog.txt file which will be located here, once enabled: C:\Documents and Settings\<em>user_name</em>\Application Data\Macromedia\Flash Player\Logs\flashlog.txt (XP) or C:\Users\<em>user_name</em>\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt (Vista).</p>
<p>The <a href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;file=logging_125_04.html">debugger configuration page</a> details where to place the mm.cfg file and what to put in it in order to enable output to the flashlog.txt file. For example, if you&#8217;re running XP, you would create a new mm.cfg file in your &#8220;C:\Documents and Settings\<em>user_name</em>\&#8221; folder and you would put the following lines inside to enable error reporting and trace logging (i.e. output to the flashlog.txt file):</p>
<pre><code>TraceOutputFileEnable=1
ErrorReportingEnable=1</code></pre>
<h2>Running the Solution</h2>
<p>Now that the form guide is designed, we&#8217;re ready to run our solution: Launch GB again and this time, choose the Preview tab, select &#8220;Include PDF Preview&#8221; (to ensure that a PDF is included, otherwise you won&#8217;t be able to flip to it to see the results) and click on the Preview button.</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-9.Png"></p>
<p>The resulting form guide should look like this (with the pre-loaded actor and category lists):</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-10.Png"></p>
<p>When you click on the &#8220;Get Movies&#8221; button, the button will become temporarily disabled and then, assuming your query returned movies, the count should be updated and the &#8220;Movie Listing&#8221; panel should appear in the left toggle bar:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-11.Png"></p>
<p>Now click on the &#8220;Movie Listing&#8221; panel to see the results in the form guide:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-12.Png"></p>
<p>Finally, click on the &#8220;Show PDF&#8221; icon in the toolbar at the top-right to see the results (i.e. imported Movie Service data) in the PDF:</p>
<p><img src="http://forms.stefcameron.com/images/Max2008/Max2008Tutorial-Part3-13.Png"></p>
<p>Cool? I think so! And the cherry on top is that this even works with the free Reader! Users don&#8217;t need Acrobat in order for the data to go back and forth between the form guide and the PDF.</p>
<h2>Solution to Part 3</h2>
<p>Try not to peek at this before you attempt to build the form guide on your own…</p>
<p><a href="http://forms.stefcameron.com/samples/max2008/Max2008-MovieCatalog-Part3.zip">Download Part 3 [zip]</a></p>
<p><strong>Minimum Requirements:</strong> Designer 8.2.1 SP1, GuideBuilder 8.2.1 SP1, Reader 9.0.</p>
<p><strong>Note:</strong> If you decide to deploy this sample to LiveCycle (e.g. using FormsIVS), you&#8217;ll also need to deploy the styles SWC you created earlier. The form guide will not render without it.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/11/19/max-2008-tutorial-part3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Digital Signature Field Status</title>
		<link>http://forms.stefcameron.com/2008/11/05/digital-signature-field-status/</link>
		<comments>http://forms.stefcameron.com/2008/11/05/digital-signature-field-status/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 17:00:30 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/11/05/digital-signature-field-status/</guid>
		<description><![CDATA[Have you ever needed to verify the status of a digital signature (&#8220;DigSig&#8221;) field in a form? A typical scenario would be that a form is to be signed prior to being submitted and you don&#8217;t want the submit button to be available until the user has successfully signed the form. Unfortunately, the &#8220;lock fields [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to verify the status of a digital signature (&#8220;DigSig&#8221;) field in a form? A typical scenario would be that a form is to be signed prior to being submitted and you don&#8217;t want the submit button to be available until the user has successfully signed the form. Unfortunately, the &#8220;lock fields after signing&#8221; feature, available as of Designer/Acrobat 8, won&#8217;t be enough in this case because it&#8217;ll only lock the fields after a signature has been applied; it won&#8217;t also make the submit button visible/enabled.</p>
<p>There&#8217;s a feature in <a href="http://www.adobe.com/devnet/acrobat/pdfs/js_api_reference.pdf">Acrobat&#8217;s scripting object model</a> that lets you determine the status of a DigSig field (i.e. whether it&#8217;s signed or not): It&#8217;s the <a href="http://forms.stefcameron.com/2006/06/10/acroform-objects/">AcroForm</a> Field object&#8217;s <em>signatureValidate()</em> method which returns a status code indicating the state of the signature field. In particular, the method returns 0 if the DigSig field is empty (hasn&#8217;t been signed) and 4 if the DigSig applied is valid and the identify of the signer was verified.</p>
<blockquote><p><strong>Note:</strong> This method cannot validate the status of an XML Data Signature which is different from a traditional DigSig.</p></blockquote>
<h2>Accessing the AcroForm Field Object</h2>
<p>To access the AcroForm Field object that represents the XFA DigSig field in your form, you have to use the AcroForm Doc object&#8217;s <em>getField()</em> method and give it the name of the field you&#8217;re looking for.</p>
<p>To access the Doc object, you simply need to access the <em>event.target</em> property in any XFA event. This property <em>is</em> the Doc object. From there, you call getField() and you give it the name of the DigSig field <strong>as it&#8217;s defined in the AcroForm DOM</strong>. That&#8217;s the tricky part: Your field&#8217;s full name is its SOM expression (shown here for a DigSig field in a page subform named &#8220;PageSubform1&#8243;):</p>
<pre><code>xfa.form.form1.PageSubform1.SignatureField1</code></pre>
<p>however its <strong>AcroForm Field Name</strong> looks like this:</p>
<pre><code>form1[0].PageSubform1[0].SignatureField1[0]</code></pre>
<p>Fortunately, I&#8217;ve already written some JavaScript that generates the above syntax: Copy and paste the script from my <a href="http://forms.stefcameron.com/2006/06/14/acroform-field-name-generator/">AcroForm Field Name Generator</a> into your event and all you have to do in your script is call <em>GetFQSOMExp(DigSigField)</em> where &#8220;DigSigField&#8221; is the XFA DigSig field whose AcroForm Field name you can to get.</p>
<p>From there, you simply make a call to the signatureValidate() method:</p>
<pre><code>var status = event.target.getField(GetFQSOMExp(DigSigField).signatureValidate();

switch (status)
{
    case 0:
    case 1:
        // not signed...
        break;

    case 2:
        // invalid signature...
        break;

    case 3:
        // valid but identity of signer cannot be verified...
        break;

    case 4:
        // valid signature...
        break;

    default:
        // error -- unexpected status code
        break;
}</code></pre>
<h2>PreSign and PostSign Events</h2>
<p>A key component to making this work is the ability to verify the status of the signature after the user has interacted with the DigSig field. You may think of using either the Click or MouseUp events on the DigSig field however there&#8217;s a bug in Acrobat/Reader 9 (and older) that prevents the Click and MouseUp events from coming through if the user successfully applies a signature (if they cancel-out of the digital signature dialog that appears when they click in the DigSig field, the events fire but not if they apply a signature).</p>
<p>Fortunately, XFA 2.8 includes new PreSign and PostSign events which occur just before and immediately after clicking on the DigSig field and they behave correctly. The only drawback here is that they are only available for scripting in Designer 8.2 and only work in Acrobat/Reader 9 or greater.</p>
<blockquote><p>Note that if you wanted to check for signature status on start-up, the DocReady event is the correct place to do it. Initialize, FormReady and LayoutReady events are too soon in the initialization sequence for signature status to be available.</p></blockquote>
<h2>Sample Form</h2>
<p>Getting back to our use case where we want to show the submit button only once the user has signed the form, you would simply script the DigSig field&#8217;s PreSign event to show the button and then the PostSign event to check the status of the signature. If it&#8217;s not valid (the user didn&#8217;t apply a signature or there&#8217;s something wrong with the signature that was applied), you would then hide the submit button again.</p>
<blockquote><p>The reason why you would show the submit button in PreSign and hide it again in PostSign is because showing the button in PostSign after applying a good signature would invalidate the signature&#8217;s status (the status would become &#8220;unknown&#8221;) because the form would be modified after signing. By showing the button after signing when it was hidden prior to it, the form would no longer be the state in which it was when it was signed (which is one reason for DigSigs in the first place &#8212; to ensure that the document is in the same state as which it was when the user signed it, otherwise the document may have been maliciously modified between the time when the user signed it and the time at which you received it).</p></blockquote>
<p><a href="http://forms.stefcameron.com/samples/DigSigFieldStatus.pdf">Download sample [pdf]</a></p>
<p>(Note that you&#8217;ll need a digital ID to run the sample; if you don&#8217;t, you can easily create one in the digital signature dialog that appears when you click on the DigSig field.)</p>
<p><strong>Sample Minimum Requirements:</strong> Designer 8.2, Acrobat 9.0</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/11/05/digital-signature-field-status/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Bug: Cannot Clear Radio Button List Selection</title>
		<link>http://forms.stefcameron.com/2008/10/09/bug-cannot-clear-radio-button-list-selection/</link>
		<comments>http://forms.stefcameron.com/2008/10/09/bug-cannot-clear-radio-button-list-selection/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:13:31 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/?p=208</guid>
		<description><![CDATA[Description Normally, setting a field&#8217;s rawValue property to null essentially clears its value. It should follow that setting a radio button list&#8217;s rawValue property would clear its selection (i.e. if one of its radio buttons was selected, none would be selected when its value is set to null). To clear a text field, for example, [...]]]></description>
			<content:encoded><![CDATA[<h2>Description</h2>
<p>Normally, setting a field&#8217;s rawValue property to <em>null</em> essentially clears its value. It should follow that setting a radio button list&#8217;s rawValue property would clear its selection (i.e. if one of its radio buttons was selected, none would be selected when its value is set to null).</p>
<p>To clear a text field, for example, you would do the following:</p>
<pre><code>MyTextField.rawValue = null;</code></pre>
<p>To clear a radio button list, the following should also work:</p>
<pre><code>MyRadioButtonList.rawValue = null;</code></pre>
<p>The issue is that the above statement for clearing a radio button list doesn&#8217;t work: The selection remains and the radio button list&#8217;s rawValue property remains set to the value of the selected radio button.</p>
<h2>Workaround</h2>
<p>There are two workarounds to this issue. The first consists of clearing the data node associated with the radio button list, provided the radio button list is <em>bound to data</em> (which means the &#8220;Object palette &gt; Binding tab &gt; Default Binding property&#8221; is set to something other than &#8220;None&#8221;):</p>
<pre><code>MyRadioButtonList.dataNode.isNull = 1;</code></pre>
<p>Note that if you attempt to use this workaround when the radio button list is not bound to data, an error will occur because its dataNode property will be null and you&#8217;ll attempt to access the isNull property of a null object.</p>
<p>The second workaround consists of using the xfa.host.resetData() method to clear the radio button list:</p>
<pre><code>xfa.host.resetData(MyRadioButtonList.somExpression);</code></pre>
<p>The advantage of the second workaround is that it will work regardless of whether the radio button list has a data binding or not.</p>
<h2>Fix</h2>
<p>Please refer to the <a href="http://forms.stefcameron.com/bug-list/" target="_blank">Bug List</a> for updated information on the version(s) affected by this bug as well as if and when it was/will be fixed.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/10/09/bug-cannot-clear-radio-button-list-selection/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tab Order Revamped</title>
		<link>http://forms.stefcameron.com/2008/09/22/tab-order-revamped/</link>
		<comments>http://forms.stefcameron.com/2008/09/22/tab-order-revamped/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 13:00:54 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Form Fragments]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/?p=184</guid>
		<description><![CDATA[Back when I announced that Designer 8.2 and Acrobat 9 had shipped, I mentioned that there had been a &#8220;major tab ordering UI update&#8221;. The Team knew that something had to be done to address all the issues you had been experiencing (it follows that it was the most requested feature on my Designer 8.2 [...]]]></description>
			<content:encoded><![CDATA[<p>Back when I <a href="http://forms.stefcameron.com/2008/07/03/acrobat-pro-9-with-designer-82-now-available/">announced</a> that Designer 8.2 and Acrobat 9 had shipped, I mentioned that there had been a &#8220;major tab ordering UI update&#8221;. The Team knew that something had to be done to address all the issues you had been experiencing (it follows that it was the most requested feature on my <a href="http://forms.stefcameron.com/featur-o-meter-designer-82/">Designer 8.2 Featur-O-meter</a>) and I think they really delivered!</p>
<h2>Make it so</h2>
<p>I think one of the most significant improvements to the functionality is that what you set in Designer is what you get in Acrobat. In the past, given certain circumstances, the order you set in Designer was not necessarily the order you would get in Acrobat. Designer 8.2 and Acrobat/Reader 9, together, fix that issue.</p>
<p>For example, this view shows the new Tab Order palette where tab order is set to &#8220;Automatic&#8221; which means the order depends largely on the visual placement of fields on the form, from left to right and top to bottom:</p>
<p><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-1.png"> </p>
<p>In this next view, I&#8217;ve simply moved the City field below the Country field. As you can see in the tab order list, City is now last in tab order simply because it&#8217;s <em>positioned</em> below the Country field (and it&#8217;s also highlighted in the list because I have it selected on the canvas):</p>
<p><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-2.png"> </p>
<h2>Tab Order palette</h2>
<p>The Tab Order palette is how you work with tab order in Designer 8.2. While there is still a &#8220;tab order mode&#8221;, you no longer (attempt to) set the order by entering tab order mode and clicking on fields on the canvas in the order you want tab order to be set. Instead, you do everything from the palette (sequence numbers are still displayed over the fields and you can still click on them to select their corresponding item in the tab order list within the Tab Order palette but the order itself is no longer set by clicking on the canvas).</p>
<p>Before we go any further, there&#8217;s some extra visual aids for tab order which you&#8217;ll want to turn-on (if anything, they&#8217;re <strong>really cool</strong>). In the &#8220;Tools menu &gt; Options command &gt; Tab Order tab&#8221;, set the &#8220;Display Additional Visual Aids for Tab Order&#8221; setting:</p>
<p><a name="tabOrderProperties"></a><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-3.png"> </p>
<p>Now select the Tab Order palette (&#8220;Window menu &gt; Tab Order command&#8221;) and you&#8217;ll automatically be entered into &#8220;tab order mode&#8221; (if not, click on the &#8220;Show Order&#8221; button on the palette):</p>
<p><a name="tabOrderPalette"></a><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-4.png"> </p>
<p>Once this is done, set the order to &#8220;Custom&#8221; so that you can set the order you want.</p>
<p>To get a feel for what the order is (now that you&#8217;ve enabled the &#8220;additional visual aids&#8221;), you can simply mouse-over the fields on the canvas:</p>
<p><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-5.png"> </p>
<p>(In the above screen shot, my mouse is hovering over the City field.)</p>
<h2>Setting the order</h2>
<p>Using the object list in the Tab Order palette, the order can be set in many different ways:</p>
<ul>
<li>drag and drop the items in the list
<li>multi-select items in the list and drag &amp; drop them
<li>make a selection and use the arrow buttons to move them around
<li>select one item and hit the F2 key to manually set its sequence number
<li>make a selection (either with the mouse or the keyboard) and change the order by holding the Control key while using the up/down arrow keys
<li>cut and paste a selection using the items in the palette menu</li>
</ul>
<h2>Form Fragments</h2>
<p>The Tab Order feature also handles form fragments gracefully and treats them as &#8220;white blocks&#8221;. Following my address block example, if you make a fragment out of the City, State and Zip fields, that object is now treated as a single object. The tab order can&#8217;t be changed from the <em>reference</em> to the fragment (i.e. the tab order of the fields inside the fragment can&#8217;t be changed from the form that references the fragment) but it can be changed <em>around</em> it:</p>
<p><img src="http://forms.stefcameron.com/images/Des82TabOrder/Des82TabOrder-6.png"> </p>
<p>In order to change the tab order <em>inside</em> the fragment, you&#8217;ll need to edit the tab order in the fragment itself.</p>
<h2>Text Objects</h2>
<p>Finally, the revamped Tab Order feature is also capable of handling text objects. This comes in handy especially when you have a <a href="http://forms.stefcameron.com/2008/10/06/hyperlinks-in-form-objects/">hyperlink</a> somewhere in a text object and you want to control where, in the tabbing sequence, that focus jumps to the hyperlink and where it goes to afterward.</p>
<p>In order to set the tab order of a text object, you must uncheck the &#8220;Tools > Options > Tab Order > Only Show Tab Order for Fields&#8221; option in the <a href="#tabOrderProperties">Tab Order Properties Dialog</a> (checked in the linked screenshot: you must uncheck it).</p>
<p>After applying the above setting, the <a href="#tabOrderPalette">Tab Order Palette</a> will show all form objects, not just fields.</p>
<p class="postUpdate"><strong>Apr 3, 2010</strong> &mdash; Added &#8220;Text Objects&#8221; section</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/09/22/tab-order-revamped/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTTP Submit</title>
		<link>http://forms.stefcameron.com/2008/09/15/http-submit/</link>
		<comments>http://forms.stefcameron.com/2008/09/15/http-submit/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 16:58:57 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/09/15/http-submit/</guid>
		<description><![CDATA[In the past, I&#8217;ve written a lot of articles on submitting data to databases and web services but there&#8217;s another way to submit form data: via HTTP POST. In this scenario, you use a regular button object configured to submit to a web page via HTTP or you just use the HTTP submit button object [...]]]></description>
			<content:encoded><![CDATA[<p>In the past, I&#8217;ve written a lot of articles on <a href="http://forms.stefcameron.com/category/data-binding/">submitting data to databases and web services</a> but there&#8217;s another way to submit form data: via HTTP POST. In this scenario, you use a regular button object configured to submit to a web page via HTTP or you just use the HTTP submit button object and set the URL appropriately.</p>
<p><a href="http://blogs.adobe.com/stevex/">Steve</a>, a colleague of mine who works on LiveCycle Designer ES, wrote two posts about this technique a while back. I&#8217;ve frequently referred to it in my replies to your comments on various posts so I thought I would include the links in a more prominent place so they&#8217;re easier to find:</p>
<ol>
<li>The original <a href="http://blogs.adobe.com/stevex/2006/05/http_submit.html">HTTP Submit</a> post.
<li>An important <a href="http://blogs.adobe.com/stevex/2007/06/http_post_update.html">update</a> to the original post.</li>
</ol>
<p>One use of this could be to make submitting data to a database more secure* than exposing the database on the Internet (which is seldom a good idea). For example, you could have your form&#8217;s data posted to a PHP page which could then relay it into a MySQL database running behind the scenes. Another popular combination is ASP and Microsoft Access databases.</p>
<p class="disclaimer">* Please note that I cannot speak to the level of security of said suggestion/solution. I&#8217;m merely suggesting it <em>could</em> be more secure.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/09/15/http-submit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What About the Other Field?</title>
		<link>http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/</link>
		<comments>http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 19:32:03 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/</guid>
		<description><![CDATA[A common need in forms is to ask the user to choose between a set of options within a list, be it a radio button list, list box or drop down list. What&#8217;s more is that these lists often include an &#8220;other&#8221; option to let the user specify something more specific that isn&#8217;t included in [...]]]></description>
			<content:encoded><![CDATA[<p>A common need in forms is to ask the user to choose between a set of options within a list, be it a radio button list, list box or drop down list. What&#8217;s more is that these lists often include an &#8220;other&#8221; option to let the user specify something more specific that isn&#8217;t included in the list. The trouble is, how do you ensure that the user fills-in the &#8220;other&#8221; field prior to submitting their form?</p>
<p>I thought it might be useful to provide a sample form which demonstrates how to build a list field which has an &#8220;other&#8221; option and clicking on the &#8220;other&#8221; option displays a field for entering the specific value and makes that field required &#8212; but only if the user chooses the &#8220;other&#8221; option. (You wouldn&#8217;t want the &#8220;other&#8221; field to be hidden and required or else the user would never be able to submit their form since Acrobat would prevent the submission on the premise that there&#8217;s an un-filled required field somewhere.)</p>
<h2>&#8220;Other&#8221; Fields in Acrobat/Reader 8.1+</h2>
<p>The first thing I did was create my sample form using Designer 8.1 and Acrobat 8.1. That was very easy and just as straight-forward as I expected it would be: One radio button list, one list box and one drop down list, each set to be required and&nbsp;with their own &#8220;other&#8221; item and script to show their respective &#8220;other&#8221; field (and make it mandatory) when their &#8220;other&#8221; item is selected and hide it (and make it optional) when their &#8220;other&#8221; item is de-selected. Add a submit button and Acrobat/Reader 8.1 automatically takes care of preventing the submission if any required field isn&#8217;t filled.</p>
<p>To keep things simple, each list field has script that detects when the user either selects the &#8220;other&#8221; item or an alternate item and sets the presence and mandatory properties of its &#8220;other&#8221; field to be visible/required or invisible/optional, respectively.</p>
<p><a href="http://forms.stefcameron.com/samples/other-field/TheOtherField_Acro81.pdf">Download 8.1 sample [pdf]</a></p>
<p><strong>Minimum requirements:</strong> Designer 8.1, Acrobat/Reader 8.1</p>
<h2>&#8220;Other&#8221; Fields in Acrobat/Reader 8.0 or Earlier</h2>
<p>Unfortunately, I didn&#8217;t have the same kind of experience getting this form to work in Acrobat/Reader 8.0 or earlier.</p>
<p>The first thing I did, since my 8.1 sample form doesn&#8217;t use any functionality only available as of Designer/Acrobat 8.1 (in fact, it uses XFA properties and script functions that have been available since Designer/Acrobat 7 and likely even earlier), I simply used Designer 8.1 to set my form&#8217;s Target Version to Acrobat/Reader 7.0.5 and figured I would open it in Acrobat 7.0.9 and all would be good. Well, that wasn&#8217;t the case.</p>
<p>Aside from Acrobat not respecting the &#8220;required&#8221; setting on the radio button list (which was <em>expected</em> since required radio button lists weren&#8217;t supported until Acrobat 8.0), I discovered a <em>very strange </em>behaviour in the list box where simply having a statement within its Change event that sets a field&#8217;s mandatory property to &#8220;error&#8221; will always result in that field being required, as far as Acrobat/Reader is concerned, even if the statement doesn&#8217;t appear ever to be executed on form initialization. The result is that selecting an item other than the &#8220;other&#8221; item in the list box and attempting to submit the form prompts Acrobat to cancel the submission because a required field isn&#8217;t filled. The problem is that the required field is the list box&#8217;s &#8220;other&#8221; field which is hidden from view because it isn&#8217;t supposed to be required. Finally, there was also another issue with list boxes that have Change event script: Their value is never committed to the Data DOM, which means that the list box always appears to have no value and that also prevents the user from being able to submit the form because the list box appears never to have been filled (even though an item is clearly selected).</p>
<p>So the are&nbsp;three problems with the 8.1 sample form when it&#8217;s running in versions of Acrobat/Reader prior to 8.1:</p>
<ol>
<li>Although properly supported in Acrobat/Reader 8.0, radio button lists can&#8217;t be set to &#8220;required&#8221;;</li>
<li>List boxes with Change event script containing a statement which sets a field&#8217;s mandatory property to &#8220;error&#8221; results in that field always being &#8220;required&#8221; (this strange issue is resolved in Acrobat/Reader 8.1); and</li>
<li>List boxes with Change event script don&#8217;t commit their value to the Data DOM (this is also resolved in Acrobat/Reader 8.1).</li>
</ol>
<p>Fortunately, issues #2 and #3 can be resolved fairly easily simply by not using the Change event. The only viable alternative I found was using the Exit event instead. (Note that in the Exit event, you have to&nbsp;use the list&#8217;s &#8220;rawValue&#8221; property to determine its value rather than using the &#8220;xfa.event.newText&#8221; property as in the original Change event script.)</p>
<p>Issue #1 (required radio button lists not supported) can also be resolved although it requires a little more work. One alternative is to use the <a href="http://forms.stefcameron.com/2006/08/24/complex-validations/">&#8220;Two Button Submit&#8221; Technique</a> I described on a previous post on <a href="http://forms.stefcameron.com/2006/08/24/complex-validations/">Complex Validations</a>, which is what I implemented in my 7.x sample form.</p>
<p><a href="http://forms.stefcameron.com/samples/other-field/TheOtherField_Acro7x.pdf">Download 7.x sample [pdf]</a></p>
<p><strong>Minimum requirements:</strong> Designer 7.0, Acrobat/Reader 7.0</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Bug: Table Columns Rendered Incorrectly with New Column Width</title>
		<link>http://forms.stefcameron.com/2007/06/13/bug-table-columns-rendered-incorrectly-with-new-column-width/</link>
		<comments>http://forms.stefcameron.com/2007/06/13/bug-table-columns-rendered-incorrectly-with-new-column-width/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 15:42:49 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2007/06/13/bug-table-columns-rendered-incorrectly-with-new-column-width/</guid>
		<description><![CDATA[Description When changing a table&#8217;s column widths via the table object&#8217;s &#8220;columnWidths&#8221; attribute, the table&#8217;s columns will not be rendered correctly. For example, consider the following table: Clicking on the &#8220;Expand Columns&#8221; button sets the width of the first column to 2 inches and the width of the second column to 3 inches with the [...]]]></description>
			<content:encoded><![CDATA[<h2>Description </h2>
<p>When changing a table&#8217;s column widths via the table object&#8217;s &#8220;columnWidths&#8221; attribute, the table&#8217;s columns will not be rendered correctly.
<p>For example, consider the following table:
<p><img width="210" height="127" src="http://forms.stefcameron.com/images/BugTableColWidthChange/ColWidthChange80Bug_1.png" border="0">
<p>Clicking on the &#8220;Expand Columns&#8221; button sets the width of the first column to 2 inches and the width of the second column to 3 inches with the following script:</p>
<pre><code>Table1.columnWidths = "2in 3in";</code></pre>
<p>In Acrobat 8.0 or earlier, this is the result:</p>
<p><img height="127" src="http://forms.stefcameron.com/images/BugTableColWidthChange/ColWidthChange80Bug_2.png" width="428" border="0"></p>
<p>The problem is that the table&#8217;s layout hasn&#8217;t been properly updated after the changes to its column width attribute.</p>
<h2>Workaround </h2>
<p>Fortunately, there&#8217;s a simple workaround to this problem which consists in forcing an update to the layout after setting the column widths of a table:</p>
<pre><code>Table1.columnWidths = "2in 3in";
xfa.layout.relayout();</code></pre>
<p>Note that a lot of these table rendering issues have now been <strong>addressed in <a title="Acrobat/Reader 8.1 Update" href="http://forms.stefcameron.com/2007/06/06/acrobatreader-81-update/">Acrobat/Reader 8.1</a></strong>.</p>
<p>When using the above workaround or Acrobat/Reader 8.1, this is the result you get:</p>
<p><img height="127" src="http://forms.stefcameron.com/images/BugTableColWidthChange/ColWidthChange80Bug_3.png" width="428" border="0"></p>
<h2>Fix </h2>
<p>Please refer to the <a title="Bug List" href="http://forms.stefcameron.com/bug-list/">Bug List</a> for updated information on the version(s) affected by this bug as well as if and when it was/will be fixed.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/06/13/bug-table-columns-rendered-incorrectly-with-new-column-width/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Bug: Web service data not cleared on exception</title>
		<link>http://forms.stefcameron.com/2007/05/05/bug-web-service-data-not-cleared-on-exception/</link>
		<comments>http://forms.stefcameron.com/2007/05/05/bug-web-service-data-not-cleared-on-exception/#comments</comments>
		<pubDate>Sat, 05 May 2007 16:59:42 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Bugs]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2007/05/05/bug-web-service-data-not-cleared-on-exception/</guid>
		<description><![CDATA[Description If an exception is thrown during a web service (WSDL) data connection request call (you&#8217;re executing a request to a web service in order to get a response in return), the bound data accumulated by Acrobat (for submitting the request to the web service) is not cleared from the data connection&#8217;s &#34;request data buffer/queue&#34; [...]]]></description>
			<content:encoded><![CDATA[<h2>Description </h2>
<p>If an exception is thrown during a web service (WSDL) data connection <em>request</em> call (you&#8217;re executing a request to a web service in order to get a response in return), the bound data accumulated by Acrobat (for submitting the request to the web service) is not cleared from the data connection&#8217;s &quot;request data buffer/queue&quot; (to put it in simple terms).</p>
<p>For example, if your form attempts to execute a WSDL data connection while there is no active connection to the Internet, the call to the</p>
<pre><code>xfa.connectionSet.WSDLConnectionName.execute</code></pre>
<p>method will fail with an exception (which you can catch by placing the call within a try-catch block) however the form data accumulated to be sent as part of the request  operation isn&#8217;t cleared. If you are then resetting the form by clearing repeatable subform instances that contained data at the time the data connection was executed and then re-execute the data connection, the old instance data will still be sent as part of the new request even though it&#8217;s no longer part of the form (which is clearly not what you would want/expect).</p>
<h2>Workaround</h2>
<p>Fortunately, you can manually clear the &quot;request data buffer/queue&quot;, located in</p>
<pre><code>xfa.datasets.connectionData.WSDLConnectionName</code></pre>
<p>where &quot;WSDLConnectionName&quot; is the name of your WSDL data connection, simply by using the &quot;remove&quot; function as follows:</p>
<pre><code>xfa.datasets.connectionData.WSDLConnectionName.remove();</code></pre>
<h2>Fix</h2>
<p> Please refer to the <a href="http://forms.stefcameron.com/bug-list/">Bug List</a> for updated information on the version(s) affected by this bug as well as if and when it was/will be fixed. </p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/05/05/bug-web-service-data-not-cleared-on-exception/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

