<?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; Events</title>
	<atom:link href="http://forms.stefcameron.com/category/events/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>XFA 3.0 Specification Available</title>
		<link>http://forms.stefcameron.com/2009/03/24/xfa-30-specification-available/</link>
		<comments>http://forms.stefcameron.com/2009/03/24/xfa-30-specification-available/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 11:00:32 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/24/xfa-30-specification-available/</guid>
		<description><![CDATA[The recent update to Acrobat/Reader 9.1 supports XFA 3.0. Unfortunately, the currently-shipping version of LiveCycle Designer (even with its update) won&#8217;t author/support more than XFA 2.8 until the next release. The comments for the XFA 3.0 spec indicate that &#8220;there will be releases [of LiveCycle Form Server and LiveCycle Designer] for XFA 3.1 and they [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://forms.stefcameron.com/2009/03/11/acrobat-91-security-patch-now-available/">recent update</a> to Acrobat/Reader 9.1 supports <a href="http://partners.adobe.com/public/developer/xml/index_arch.html#xfa_30">XFA 3.0</a>. Unfortunately, the currently-shipping version of LiveCycle Designer (even with its <a href="http://forms.stefcameron.com/2009/03/17/livecycle-designer-82-update/">update</a>) won&#8217;t author/support more than XFA 2.8 until the next release. The comments for the XFA 3.0 spec indicate that &#8220;there will be releases [of LiveCycle Form Server and LiveCycle Designer] for XFA 3.1 and they will also handle 3.0.&#8221;</p>
<p>There are still some great things worth mentioning about XFA 3.0. In particular,</p>
<ul>
<li>new &#8220;<a href="http://blogs.adobe.com/formfeed/2009/03/xfa_30_presenceinactive.html">inactive</a>&#8221; value for the presence attribute which, when set on a container (e.g. subform), &#8220;prevents the container and its contents from processing calculations, validations, and events&#8221;;</li>
<li>enhancements to events framework now permits <a href="http://blogs.adobe.com/formfeed/2009/03/xfa_30_event_propagation.html">event propagation</a> upward to parent objects &#8212; this is great because you can now implement validation code on a subform for all of its children instead of having validation code in each child, for example;</li>
<li>new <a href="http://blogs.adobe.com/formfeed/2009/03/xfa_30_validation_state_change.html">validation events</a> and global <a href="http://blogs.adobe.com/formfeed/2009/03/xfa_30_message_handling_option.html">validation handling</a> control &#8212; this should address a lot of the current issues with form validation.</li>
</ul>
<p>It <a href="http://blogs.adobe.com/formfeed/2009/03/reader_91_and_xfa_30.html">looks like</a> John Brinkman will be detailing these new features, and perhaps others, soon.</p>
<p class="postUpdate"><strong>August 18, 2009</strong> &mdash; Added links to new XFA 3.0 topics on FormFeed.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/03/24/xfa-30-specification-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pre-Process Web Service Responses</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/</link>
		<comments>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 11:00:56 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/</guid>
		<description><![CDATA[Connecting to a web service usually means using import bindings to capture the response but what if you wanted to do something special with the response? What if the response wasn&#8217;t exactly correct for merging into your form (e.g. you just wanted to extract a part of the response and push it into your form [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://http://forms.stefcameron.com/2007/05/21/connecting-to-a-web-service/">Connecting to a web service</a> usually means using import bindings to capture the response but what if you wanted to do something special with the response? What if the response wasn&#8217;t exactly correct for merging into your form (e.g. you just wanted to extract a part of the response and push it into your form somewhere)?
<p>You could still use import bindings (set using the &#8220;Object palette &gt; Bindings tab &gt; Import/Export Bindings property&#8221;) but then you might have to hide most &#8212; or all &#8212; of those fields if you didn&#8217;t want to expose them. You would wait for the web service data connection to execute, then find the field that contains the piece of data you want and set it where it needs to go. This isn&#8217;t ideal, however, because Designer doesn&#8217;t expose any events, in the Script Editor, that would let you know that you now have data from the web service response in your form. Furthermore, having those extra fields around could add a lot of unnecessary weight (read: file size). </p>
<p><span id="more-356"></span><br />
<h2>postExecute event</h2>
<p>Unless you have studied the <a href="http://partners.adobe.com/public/developer/xml/index_arch.html">XML spec</a> or deciphered its existence from the <a href="http://www.adobe.com/devnet/livecycle/designing_forms.html">LC Designer ES Scripting Reference</a>, you most likely don&#8217;t know about this event because Designer&#8217;s Script Editor palette doesn&#8217;t expose it. It&#8217;s purpose is to allow for post-processing of a web service response after a particular data connection is executed. The response data is temporarily stored in </p>
<pre><code>xfa.datasets.connectionData.{DataConnectionName}</code></pre>
<p>for the duration of the data connection&#8217;s PostExecute event.</p>
<p>Since it&#8217;s not exposed in the Script Editor, you have to go to the <strong>XML Source</strong> in order to set it on a form object &#8212; typically a subform. What follows is the XFA definition for the <em>WebServiceDC</em> data connection&#8217;s PostExecute event:</p>
<pre><code>&lt;event activity="postExecute" ref="$connectionSet.WebServiceDC"&gt;
    &lt;script contentType="application/x-javascript"&gt;
        // do something...
    &lt;/script&gt;
&lt;/event&gt;</code></pre>
<p>Note that I said this was the PostExecute event <strong>for the WebServiceDC data connection</strong>. The PostExecute event on its own &#8212; without a <em>ref </em>attribute that specifies the data connection to which it pertains &#8212; is of no use. In this case, the ref attribute specifies the WebServiceDC node inside the form&#8217;s connectionSet DOM (where web service data connections are defined). (Normally, the ref attribute has a value of &#8220;$&#8221;, which means &#8220;this&#8221;, since the event usually pertains to the form object on which it is defined.)</p>
<p>If you combine this with the ability to get web service response data without merging it into the form (either by not checking the &#8220;Object palette &gt; Execute tab &gt; Re-merge Form Data property&#8221; of the execute button for the data connection or you call xfa.connectionSet.{DataConnectionName}.execute(false)), you can essentially call a web service, get data back and do whatever you like with it.</p>
<h2>Sample Form</h2>
<p>To demonstrate how this works, I&#8217;ve created a sample form that has two web service data connections. <strong>It may take some time to open</strong> in Designer depending on how fast Designer can download the WSDL files from the two web services.</p>
<p>The first one, <a href="http://www.whitemesa.net/wsdl/r3/compound2.wsdl">EchoEmployee</a>, submits data from the top 4 fields and, using the PostExecute event, adds an item for each piece of data received in the response inside the list box. The following screen shot shows a sample result:</p>
<p><img src="http://forms.stefcameron.com/images/WSResponsePreProc/WSResponsePreProc-1.jpg"> </p>
<p>The second one, <a href="http://www.webservicex.net/ConvertTemperature.asmx?wsdl">ConvertTemperature</a>, obtains the conversion of the specified temperature from the web service response and displays it in a message box.</p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/WebServiceResponsePreProc.pdf">Download Sample [pdf]</a></p>
<p><strong>Sample Minimum Requirements:</strong> While I developed the sample using Designer 8.2 and Acrobat 9.1, I have set the compatibility level to Acrobat/Reader 7.0.5 since this should work back to that version however I have not tested the form with anything earlier than 8.2/9.1.</p>
<p><strong>Update (Sep 2, 2010):</strong> Note that the &#8220;Echo Employee&#8221; web service is no longer operational. This means that the first web service connection in the sample form can no longer be executed. The script is still valid, however, and serves as a good example. The second web service, &#8220;Convert Temperature&#8221;, is still operational.</p>
<h2>Pre-Processor Library Snippet</h2>
<p>In an effort to ease the pain of having to edit the XML Source, I have created an Object Library Snippet (XFO) that you can use to easily plug into this functionality:</p>
<p><a href="http://forms.stefcameron.com/samples/data-binding/WSResponsePreProcessor.xfo">Library Snippet [xfo]</a></p>
<p>In order to use it, you will have to save it to your Object Library&#8217;s Custom snippet folder which, depending on whether you installed Designer on XP or Vista, will be in one of the following locations:</p>
<p align="left">C:\Documents and Settings\{username}\Application Data\Adobe\Designer\{version}\EN\Objects\Custom</p>
<p align="left">C:\Users\{username}\AppData\Roaming\Adobe\Designer\{version}\EN\Objects\Custom</p>
<p>Once inserted into your form, the snippet will look like this:</p>
<p><img src="http://forms.stefcameron.com/images/WSResponsePreProc/WSResponsePreProc-2.jpg"> </p>
<p>By default, it&#8217;s set to work with a web service data connection that is named &#8220;WebServiceDC&#8221;. When that data connection&#8217;s PostExecute event is fired, the script inside will find the response data and call the <em>processResponse()</em> function defined on a script object that is included in the snippet (which is essentially a subform). Finally, the subform hides itself when the form is initialized so you don&#8217;t have to worry about hiding it yourself.</p>
<p>Now all you have to do is put script in the processResponse() function <strong>using the Script Editor</strong>!</p>
<p>If you need to use a different data connection name, you&#8217;ll have to go to the XML Source and make two modifications, highlighted here:</p>
<p><img src="http://forms.stefcameron.com/images/WSResponsePreProc/WSResponsePreProc-3.jpg"> </p>
<p>The first modification is to the ref attribute of the &lt;event&gt; node that defines the PostExecute event and the second is in the script itself where it extracts the XML of the response.</p>
<p class="postUpdate"><strong>Sep 2, 2010</strong> &mdash; Added note that &#8220;Echo Employee&#8221; web service is no longer operational which affects the first of the two connection samples in the sample form.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Submit or Execute on Other Events</title>
		<link>http://forms.stefcameron.com/2009/01/30/submit-or-execute-on-other-events/</link>
		<comments>http://forms.stefcameron.com/2009/01/30/submit-or-execute-on-other-events/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 14:00:47 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/01/30/submit-or-execute-on-other-events/</guid>
		<description><![CDATA[I discovered something interesting the other day: Just because Designer wants you to type script for a field&#8217;s Full event doesn&#8217;t mean you have to execute script when the Full event is triggered. The XFA 2.8 specification specifies the &#60;event&#62; node&#8217;s content as being one of the following nodes: &#60;script&#62;, &#60;execute&#62; (executes a web service [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered something interesting the other day: Just because Designer wants you to type script for a field&#8217;s Full event doesn&#8217;t mean you have to execute script when the Full event is triggered.</p>
<p>The <a href="http://partners.adobe.com/public/developer/xml/index_arch.html">XFA 2.8 specification</a> specifies the &lt;event&gt; node&#8217;s content as being one of the following nodes: &lt;script&gt;, &lt;execute&gt; (executes a web service data connection), &lt;submit&gt; (causes the form to be submitted via email or HTTP) or &lt;signData&gt; (causes the form to be signed). Only one may be specified and whatever content is there will be executed when the event is triggered.</p>
<p>This means that you could, for example, cause a web service to be executed whenever a repeatable subform&#8217;s index changes (i.e. whenever you add/remove instances).</p>
<p>Is this useful? Well, perhaps not, but I thought it was interesting! Who knows what you might think of doing with this&#8230;</p>
<p>The only catch to all this is that Designer only lets you enter script (JavaScript or FormCalc) into an event, thereby specifying an event&#8217;s content as &lt;script&gt; as opposed to &lt;submit&gt; or &lt;execute&gt;. If you want to, say, cause a form submit when a field&#8217;s Full event is triggered, you&#8217;ll have to go to the <strong>XML Source</strong> and set the event&#8217;s content to a &lt;submit&gt; node yourself. An easy way to do this is first to add an Email/HTTP Submit Button to the form, set the field&#8217;s Full event to a placeholder script, go to the XML Source view, find the button using the Hierarchy palette, copy its Click event &lt;submit&gt; node and paste it into the field&#8217;s Full event so it looks like what&#8217;s below and delete the button:</p>
<pre><code>&lt;event activity="full" name="event__full"&gt;
    &lt;submit format="xml" textEncoding="UTF-8" target="mailto:"/&gt;
&lt;/event&gt;</code></pre>
<h2>Sample Form</h2>
<p>Check-out my little sample form that causes the form to be submitted via email when you fill the text field at the top and where a web service data connection is executed whenever you add an instance of Subform2 using the button at the bottom (below the web service import/export fields).</p>
<p><a href="http://forms.stefcameron.com/samples/SubmitAndExeOnOtherEvents.pdf">Download Sample [pdf]</a></p>
<p><strong>Sample Minimum Requirements:</strong> Designer and Acrobat Standard/Pro 8.0 (XFA 2.5)</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/01/30/submit-or-execute-on-other-events/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>XFA and AcroForm Event Object Access</title>
		<link>http://forms.stefcameron.com/2009/01/14/xfa-and-acroform-event-object-access/</link>
		<comments>http://forms.stefcameron.com/2009/01/14/xfa-and-acroform-event-object-access/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 23:08:29 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[AcroForm Objects]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2009/01/14/xfa-and-acroform-event-object-access/</guid>
		<description><![CDATA[XFA forms are event-driven. Pretty much every action triggers an event and in that event (e.g. Initialize, Change, Click, etc.), you always have access to an xfa.event object (see the &#8220;eventPseudoModel&#8221; topic on page 63 of the Designer 8.2 Scripting Reference) and, depending on whether your form is running in Acrobat/Reader, you will also have [...]]]></description>
			<content:encoded><![CDATA[<p>XFA forms are event-driven. Pretty much every action triggers an event and in that event (e.g. Initialize, Change, Click, etc.), you always have access to an xfa.event object (see the &#8220;eventPseudoModel&#8221; topic on page 63 of the <a href="http://www.adobe.com/go/learn_lc_scriptingReference_82">Designer 8.2 Scripting Reference</a>) and, depending on whether your form is running in Acrobat/Reader, you will also have access to an <a href="http://forms.stefcameron.com/2006/06/10/acroform-objects/">AcroForm</a>&nbsp;<a href="http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.560.html">event</a> object.</p>
<p>I have discovered that <em>in that event</em> isn&#8217;t quite accurate. It should rather be stated as <em>within the context of that event.</em> That&#8217;s because any function calls that you make from the event handler (for instance, into a script object that contains other functions &#8212; maybe your event handler simply passes execution to a re-usable event handler function that you have defined in this script object) will have access to these very useful objects.</p>
<p>In essence, xfa.event and event (if defined) are, for lack of a better term, <em>contextual</em> objects that exist &#8212; and are valid &#8212; as long as you are within the context (where <em>context</em> is different from usual definition of <em>scope</em>) of an event handler.</p>
<p>I had a case, just recently, where I needed to access the event.target property (that is, the AcroForm <a href="http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.374.html">Doc</a> object provided by Acrobat when it&#8217;s the host) in a function located inside a script object which I was calling from a subform&#8217;s Initialize event. At first, I thought I needed to pass it in as a parameter:</p>
<pre><code>// Subform Initialize Event handler code
utils.InitSubform(this, xfa.host.name == "Acrobat" ? event : null);

-----
utils Script Object
-----

function InitSubform(sf, hostEvent)
{
    ...
    if (hostEvent != null)
    {
        // access AcroForm Doc object from parameter
        var pdfDoc = hostEvent.target;
        ...
    }
    ...
}</code></pre>
<p>Unfortunately, this would&#8217;ve required updates to many forms since the script object was being used as a script object fragment and many forms were already using that function with only the first parameter.</p>
<p>Since the event object is actually available at that point in time, given that the handler is executing in the context of the subform&#8217;s Initialize event, I didn&#8217;t have to pass it in as a parameter and so I didn&#8217;t have to update a bunch of forms:</p>
<pre><code>// Subform Initialize Event handler code
utils.InitSubform(this);

-----
utils Script Object
-----

function InitSubform(sf)
{
    ...
    if (xfa.host.name == "Acrobat")
    {
        // access AcroForm Doc object from in-context event object
        var pdfDoc = event.target
        ...
    }
    ...
}</code></pre>
<p>Just remember that the xfa.event and event objects are only valid for the duration of the event which was triggered (so you shouldn&#8217;t hold on to them for future use) and that the event object is only available to you if the host is Acrobat/Reader (testing for xfa.host.name == &#8220;Acrobat&#8221; works for both Acrobat and Reader).</p>
<p>Tested with Adobe Acrobat and Reader 9.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2009/01/14/xfa-and-acroform-event-object-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling List Selection Changes</title>
		<link>http://forms.stefcameron.com/2008/10/27/handling-list-selection-changes/</link>
		<comments>http://forms.stefcameron.com/2008/10/27/handling-list-selection-changes/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 15:30:12 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Acrobat]]></category>
		<category><![CDATA[Designer]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/10/27/handling-list-selection-changes/</guid>
		<description><![CDATA[This is something I get asked a lot so I thought I&#8217;d write a little tutorial on how to handle a selection change in a list object (drop down list or list box). Single Selection Lists All XFA events have an object that represents properties about the event currently in execution: xfa.event This object holds [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I get asked a lot so I thought I&#8217;d write a little tutorial on how to handle a selection change in a list object (drop down list or list box).</p>
<h2>Single Selection Lists</h2>
<p>All XFA events have an object that represents properties about the event currently in execution:</p>
<pre><code>xfa.event</code></pre>
<p>This object holds many interesting properties but the one that&#8217;s important here is the <strong>newText</strong> property which, for a list, contains the new selection.</p>
<p>It&#8217;s important to note that there are two types of list items: Ones that have <strong>text data only</strong> and ones that have both <strong>text and value data</strong>. By default, the Object palette creates lists with items that have text data only. On the Field tab, you can add/remove items and specify their text data while on the Binding tab, you can optionally set each item&#8217;s value data by checking the &#8220;Specify Item Values&#8221; box.</p>
<p>The xfa.event.<strong>newText</strong> property <strong>always</strong> returns the <strong>text data</strong>. You can access the value data <em>associated</em> with the new text data by using the list&#8217;s boundItem() method:</p>
<pre><code>// get the value data associated with the new selected text data
var newValue = MyList.boundItem(xfa.event.newText);</code></pre>
<p>For single selection lists, you can therefore use the text data or get the associated value data for the new selection and do something from there. The following code sample gets the new selected value data in a list object&#8217;s Change event and changes the list&#8217;s background color accordingly:</p>
<pre><code>var newValue = this.boundItem(xfa.event.newText);

switch (newValue)
{
    case 1:
        this.fillColor = "255,0,0"; // red
        break;

    case 2:
        this.fillColor = "0,255,0"; // green
        break;

    case 3:
        this.fillColor = "0,0,255"; // blue
        break;
}</code></pre>
<h2>Multiple Selection Lists</h2>
<p>List objects may also support a multiple selection of items. You can specify that the list supports multiple selection by setting the &#8220;Object palette &gt; Field tab &gt; Allow Multiple Selection&#8221; property but you cannot specify a default selection of multiple items using the Object palette (only a single default selection is supported though it still works for lists that allow multiple selections). You would have to use the list&#8217;s Initialize script to do that.</p>
<p>At runtime (e.g. in Acrobat/Reader), you may select multiple items in the list by using the Shift and Ctrl keyboard keys: Shift + Click will select all items from the last selected item to the item you click on and Ctrl + Click will add/remove individual (non-sequential) items to/from the selection.</p>
<p>Determining the selection in a multiple selection list is different from doing so in a single selection list because you have to deal with the fact that more than one item may be selected. There is also a <strong>difference in the event</strong> you must use in order to handle the change in selection: When you set the &#8220;Allow Multiple Selection&#8221; property, the &#8220;Object palette &gt; Field tab &gt; Commit On&#8221; property changed to allow only a setting of &#8220;Exit&#8221; (as of Designer 8.1; Designer 8.0 may have still allowed &#8220;Select&#8221; to be chosen however I recommend setting this property to &#8220;Exit&#8221; if you have the choice) which means that the change in selection &#8212; as far as the list is concerned &#8212; will only take place once the user <em>exits</em> the list (once they hit the Enter key, tab away or click away from the list) rather than immediately when they <em>visually </em>change the selection. The result is that you must handle the change in selection in the <strong>Exit Event</strong> rather than in the Change event as in single selection lists.</p>
<blockquote><p>You can handle a change in single selection lists using the Exit event as well however for single selection lists, it&#8217;s usually preferable to handle the change immediately rather than once the user leaves the list. For multiple selection lists, the idea is that the user may click more than once to set the selection they want so you typically want to react to the change only once they&#8217;re done which is why the selection is only committed once the user exits the list.</p></blockquote>
<p>Determining the set of selected items was really difficult leading up to Designer and Acrobat/Reader 8.0 when the <a href="http://forms.stefcameron.com/2007/02/01/new-list-object-properties-and-methods/" target="_blank">new list object properties and methods</a> were finally introduced. These new APIs make it much easier to deal with lists that contain multiple selections: Use the <strong>length</strong> property to iterate through the items, the <strong>getDisplayItem</strong> method to get the <strong>text data</strong> associated with an item, the <strong>getSaveItem</strong> method to get the <strong>value data</strong> associated with an item and the <strong>getItemState</strong> method to determine whether the item is selected or not.</p>
<p>Here&#8217;s our sample script from earlier that sets the background color of the list object after a change in the selection (in the list&#8217;s Change event) however this time the script is meant for the <strong>Exit event</strong> and the list supports multiple selection. The color values are combined if more than one is selected, producing more color combinations up to white (an RGB color value of &#8220;255,255,255&#8243;) then all 3 items are selected:</p>
<pre><code>// array with 3 elements, all at zero initially
var rgb = new Array(0, 0, 0);

for (var i = 0; i &lt; this.length; i++)
{
    if (this.getItemState(i))
    {
        // item is selected
        // item values are 1, 2 or 3 (1-based)
        // array elements are 0, 1 or 2 (0-based)
        rgb[this.getSaveItem(i) - 1] = 255;
    }
}

// Array.toString() produces a comma-delimited string containing the
//  values of the array elements so this will produce "255,0,255" if
//  items 1 and 3 are selected.
this.fillColor = rgb.toString();</code></pre>
<p>If you give this a try, remember to create a list with 3 items (1, 2, 3) and place the script in the Exit event, not the Change event. Then remember to click away from the list once you&#8217;ve set the selection at runtime.</p>
<h3>Multiple Item Default Selection</h3>
<p>Setting a default selection of more than one item is unfortunately not something that Designer supports. To achieve this, you&#8217;ll need to set the list&#8217;s Initialize script to do the work. For example, to initialize a multiple selection list of 5 items where items 1, 4 and 5 are selected, you would do this (remember that list item indexes are 0-based, not 1-based) in the list&#8217;s Initialize event:</p>
<pre><code>this.setItemState(0, true); // item 1
this.setItemState(3, true); // item 4
this.setItemState(4, true); // item 5</code></pre>
<h2>Sample</h2>
<p>To see this in action in what you might consider a more realistic example, my <a href="http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/" target="_blank">&#8220;What About the Other Field?&#8221;</a> tutorial uses single selection lists that show an &#8220;other&#8221; field when their &#8220;other&#8221; item is selected.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/10/27/handling-list-selection-changes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New Form Design Best-Practices Blog</title>
		<link>http://forms.stefcameron.com/2008/10/15/new-form-design-best-practices-blog/</link>
		<comments>http://forms.stefcameron.com/2008/10/15/new-form-design-best-practices-blog/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 13:48:57 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Designer]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/10/15/new-form-design-best-practices-blog/</guid>
		<description><![CDATA[John Brinkman, a colleague of mine at Adobe and the LiveCycle Forms Architect no less, has decided to start a new blog on form design. It looks like he will be concentrating on on best-practices relating to form design and scripts based on past experience with forms from various customers (in other words, based on [...]]]></description>
			<content:encoded><![CDATA[<p>John Brinkman, a colleague of mine at Adobe and the LiveCycle Forms Architect no less, has decided to start a <a href="http://blogs.adobe.com/formfeed/2008/10/hello.html" target="_blank">new blog on form design</a>. It looks like he will be concentrating on on best-practices relating to form design and scripts based on past experience with forms from various customers (in other words, based on real-world forms).</p>
<p>Hi first post relates to <a href="http://blogs.adobe.com/formfeed/2008/10/build_a_better_exclusion_group.html" target="_blank">exclusion group-like functionality</a> using any type (or combination) of fields in a subform where each field is treated as a mutually-exclusive radio button. Check it out, it works very nicely!</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/10/15/new-form-design-best-practices-blog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Submitting Form Data by Email</title>
		<link>http://forms.stefcameron.com/2008/08/28/submitting-form-data-by-email/</link>
		<comments>http://forms.stefcameron.com/2008/08/28/submitting-form-data-by-email/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 14:45:33 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/08/28/submitting-form-data-by-email/</guid>
		<description><![CDATA[A frequently-asked question is, &#34;how do I modify the email in an email submit button?&#34; Usually, the reason behind the question is that a form should either be routed to a specific person depending on data entered at runtime (so you can&#8217;t predict the data and therefore you can&#8217;t set the email submit button accordingly [...]]]></description>
			<content:encoded><![CDATA[<p>A frequently-asked question is, &quot;how do I modify the email in an email submit button?&quot; Usually, the reason behind the question is that a form should either be routed to a specific person depending on data entered at runtime (so you can&#8217;t predict the data and therefore you can&#8217;t set the email submit button accordingly at design-time) or perhaps the form even presents a list of possible recipients and the user must choose which person to send the submission data to.</p>
<h2>The Secret</h2>
<p>The secret to changing the email recipient for an email submit button (or even changing it for a regular button which you&#8217;ve turned into a submit button using the &quot;Object palette &gt; Field tab &gt; Control Type &gt; Submit property&quot;) is to set the &quot;target&quot; attribute of the &lt;submit&gt; node that is part of the button&#8217;s Click event. The &quot;target&quot; specifies the URL to which the data will be submitted. <strong>HTTP</strong> and <strong>mailto</strong> are valid protocols.</p>
<p>In XFA, the difference between a regular button with Click event script and a submit button which submits form data when it&#8217;s clicked is that the submit button&#8217;s Click event has a &lt;submit&gt; node instead of a &lt;script&gt; node.</p>
<p>A regular button&#8217;s Click event:</p>
<pre><code>&lt;event activity=&quot;click&quot;&gt;
    &lt;script contentType=&quot;application/x-javascript&quot;&gt;
        // your JavaScript code here...
    &lt;/script&gt;
&lt;/event&gt;</code></pre>
<p>versus a submit button&#8217;s Click event (set to email form data in this case because of the &quot;mailto&quot; protocol):</p>
<pre><code>&lt;event activity=&quot;click&quot;&gt;
    &lt;submit format=&quot;xml&quot; textEncoding=&quot;UTF-8&quot; target=&quot;mailto:&quot;/&gt;
&lt;/event&gt;</code></pre>
<h2>How is it done?</h2>
<p>Changing the recipient is done simply by setting the submit button&#8217;s target appropriately, following the rules of the protocol you wish to use. In this case, we&#8217;ll be using the <a href="http://www.ianr.unl.edu/internet/mailto.html">mailto protocol</a>. Of course, we can do much more than change the recipient: We can actually specify multiple recipients, CC some others, BCC others still, specify any subject we want and even specify a customized email body (message)! All that needs to be done is to apply the mailto protocol when specifying the submit button&#8217;s target.</p>
<p>For example, setting the target to the following string would create an email with two recipients (one &quot;to&quot; and one CC&#8217;d), a subject and a body:</p>
<pre><code>mailto:john@asdf.com?cc=lisa@adsf.com&amp;subject=Re: New Account Opening&amp;body=Thank%20you%21&quot;</code></pre>
<p>Note that the body must be URL-encoded using the &quot;%&quot; codes for non-URL characters such as &quot;%20&quot; for a space and &quot;%21&quot; for an exclamation mark (!). Thankfully, we can use the <strong>encodeURIComponent(string)</strong> method in JavaScript to do that part for us!</p>
<p>The most difficult part of all this is finding the Click event (since there could be multiple &lt;event&gt; nodes specified on a single field, one for each event that does something) and locating the &lt;submit&gt; node inside.</p>
<h2>Sample Form</h2>
<p>To illustrate how this is done, I&#8217;ve created a sample form that submits an address block as data and provides fields for specifying the recipient(s), CC list, BCC list, subject and body of the email.</p>
<p><img src="http://forms.stefcameron.com/images/SubmitByEmail/SubmitByEmail-FilledForm.png" /> </p>
<p>The result of the above settings is a new email with the specified recipients, subject and body, along with the attached XML data file:</p>
<p>&#160;<img src="http://forms.stefcameron.com/images/SubmitByEmail/SubmitByEmail-NewEmailDialog.png" /> </p>
<p>In order to accomplish this, I used the <a href="http://forms.stefcameron.com/2006/08/24/complex-validations/#tbs">two-button submit technique</a> where a regular button is used to set the properties on a hidden email submit button. Doing it this way also lets me easily prevent the submission if there are no recipients (&quot;to&quot;) selected. (Note that the To, CC and BCC fields are multi-select list boxes so you can choose multiple email addresses.) You&#8217;ll be interested in the script in the &quot;Send&quot; button&#8217;s Click event.</p>
<p><a href="http://forms.stefcameron.com/samples/SubmitByEmail.pdf">Download Sample [pdf]</a></p>
<p><strong>Minimum Requirements:</strong> Designer 8.0, Acrobat/Reader 8.0 for this form since it uses functions that are part of the <a href="http://forms.stefcameron.com/2007/02/01/new-list-object-properties-and-methods/">new List Object API</a> which was introduced with the 8.0 versions however you could access the selected items differently and get this to work in previous versions as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/08/28/submitting-form-data-by-email/feed/</wfw:commentRss>
		<slash:comments>105</slash:comments>
		</item>
		<item>
		<title>Form Object Order of Initialization</title>
		<link>http://forms.stefcameron.com/2008/05/09/form-object-order-of-initialization/</link>
		<comments>http://forms.stefcameron.com/2008/05/09/form-object-order-of-initialization/#comments</comments>
		<pubDate>Fri, 09 May 2008 15:30:14 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/2008/05/09/form-object-order-of-initialization/</guid>
		<description><![CDATA[Here&#8217;s a quick observation you might find useful: The order in which form objects are initialized is &#8220;field and depth-first&#8221; according to the document order (the top-down order in which they appear in the Hierarchy palette in LiveCycle Designer). This means that fields inside a subform are initialized before the subform itself is initialized. When [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick observation you might find useful: The order in which form objects are initialized is &#8220;field and depth-first&#8221; according to the document order (the top-down order in which they appear in the Hierarchy palette in LiveCycle Designer). This means that fields inside a subform are initialized before the subform itself is initialized. When you think about it, it makes sense since this means that in a subform&#8217;s Initialize event, you always have access to properly-initialized child form objects. You can read more about event execution order in the <a href="http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics.html">LiveCycle Designer Scripting Basics</a> document (page 24) as well as in the </p>
<p><a href="http://partners.adobe.com/public/developer/xml/index_arch.html">XFA Spec</a> (page 353 in version 2.7).
<p>Say your form object hierarchy looked like this (in the Hierarchy palette in Designer):
<p><img alt="Hierarchy Order" src="http://forms.stefcameron.com/images/OrderOfInitialization/HierarchyOrder-1.jpg">
<p>The fields and subforms would get initialized in the following order:
<p><img alt="Order of Initialization" src="http://forms.stefcameron.com/images/OrderOfInitialization/OrderOfInitialization-1.jpg"></p>
<p>To clarify, this is the order (note that text objects don&#8217;t get initialized just like squares, circles and images wouldn&#8217;t &#8212; image <em>fields</em> would, however): </p>
<ol start="0">
<li>DateTimeField1
<li>TextField1
<li>PasswordField1
<li>Subform2
<li>NumericField1
<li>Subform1
<li>CheckBox1</li>
</ol>
<p>To demonstrate this, I&#8217;ve provided the form that contains the objects above. When you preview the form (or view it in your web browser) using Acrobat, use the <a href="http://forms.stefcameron.com/2006/05/05/debugging-scripts/">JavaScript Console</a> to see the output from the Initialize events of the various form objects to see the order of initialization.</p>
<p><a href="http://forms.stefcameron.com/samples/OrderOfInitialization.pdf">Download Sample [pdf]</a></p>
<p><strong>Minimum Requirements:</strong> I created this form in Designer 8.1.1 SP2 and tested it in Acrobat Pro 8.1.2.</p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2008/05/09/form-object-order-of-initialization/feed/</wfw:commentRss>
		<slash:comments>14</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>Setting JavaScript as the Default for New Forms</title>
		<link>http://forms.stefcameron.com/2007/01/10/setting-javascript-as-the-default-for-new-forms/</link>
		<comments>http://forms.stefcameron.com/2007/01/10/setting-javascript-as-the-default-for-new-forms/#comments</comments>
		<pubDate>Wed, 10 Jan 2007 19:05:33 +0000</pubDate>
		<dc:creator>Stefan Cameron</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Script Editor]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=63</guid>
		<description><![CDATA[If you&#8217;ve ever written scripts in Designer, you will have noticed that the default scripting language is FormCalc which is a problem if you need to (or prefer) to write your scripts in JavaScript. The easiest way to make sure that all your new scripts default to the JavaScript language is to use the Form [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever written scripts in Designer, you will have noticed that the default scripting language is FormCalc which is a problem if you need to (or prefer) to write your scripts in JavaScript.</p>
<p>The easiest way to make sure that all your <strong>new</strong> scripts default to the JavaScript language is to use the Form Properties dialog and set JavaScript as the default scripting language (in the Defaults tab). The problem with this setting is that it affects <strong>only the current form</strong>. If you&#8217;re like me, you create lots of forms every day, you constantly forget that the default scripting language is FormCalc and you only remember once you&#8217;re running your form and you get a FormCalc error message box in Acrobat telling you that your syntax is incorrect. How annoying!</p>
<p>Fortunately, there&#8217;s a way to set JavaScript as the default scripting language for all new forms &#8212; based on a specific <strong>template</strong>. The default setting for the scripting language is actually specified as a <strong>processing instruction in the XML Source</strong>. If you create a new document and go to the XML Source tab, you&#8217;ll find the following processing instruction set as a child of the &lt;template&gt; element (also shown in the image below): </p>
<pre><code>&lt;?templateDesigner DefaultLanguage FormCalc?&gt;</code></pre>
<p><img src="http://forms.stefcameron.com/blog/images/PIInXMLSource_1.Png" width="413" height="129" /></p>
<p>Since all new documents created in Designer are based on templates and that each template comes with its own set of processing instructions, modifying the processing instruction in the <strong>template</strong> would effectively modify the default scripting language on <strong>all new forms based on that template</strong>. Going one step further and making that modified template your default template would ensure makes things even easier when you&#8217;re creating new forms.</p>
<p>Fortunately, you don&#8217;t have go to the XML Source view to modify this processing instruction. Instead, you can set its value using the <strong>Form Properties dialog</strong> (accessible via the File menu): In the Defaults tab, set the Default Language property to &#8220;JavaScript&#8221;.</p>
<h2>Modifying Designer Templates</h2>
<p>In Designer, you use the <strong>Template Manager</strong> to organize your templates. You can access the Template Manager from the Tools menu.</p>
<p>To modify a template, you can follow these easy steps:</p>
<ol>
<li> Create a new document based on the template you wish to modify.</li>
<li>Make the necessary modifications (like setting the processing instruction for the default scripting language setting to &quot;JavaScript&quot;).</li>
<li>Save the new document as an &quot;Adobe LiveCycle Designer Template (*.tds)&quot; file. If you want to replace an existing template (say &quot;Letter&quot;), use that same name as the file name for the new (modified) template file you&#8217;re saving. </li>
<li>Using the Template Manager, select the tab pertaining to the group in which you want to add your new template. If you&#8217;re wanting to replace the &quot;Letter&quot; template, for example, select the &quot;Standard&quot; tab.</li>
<li>Right-click in the list panel and select &quot;Add Template&#8230;&quot;. Select the template you just saved and it&#8217;ll be added to Designer&#8217;s &quot;template store&quot;. Note that if the name of your new template file is the same as an existing template in the group you selected (e.g. the &quot;Letter&quot; template in the &quot;Standard&quot; group), you&#8217;ll be prompted to overwrite the existing template.</li>
</ol>
<p>One important thing to note in the way Designer handles templates is that any template file you add to the Template Manager gets <strong>copied</strong> into the &quot;template store&quot; which means that new documents based on that template aren&#8217;t actually based on the template file in the location where you saved it but rather on the copy that was placed in the &quot;template store&quot;. </p>
<p>If you&#8217;re wondering what the &quot;template store&quot; is, it&#8217;s actually a folder inside Designer&#8217;s Application Data folder on your system. While I don&#8217;t encourage you to look in there (because you might see things that look interesting but you shouldn&#8217;t be playing with <img src='http://forms.stefcameron.com/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , if you find them, then you should also be able to open them directly in Designer and modify them without having to create a separate copy.</p>
<p><sub class="postUpdate"><strong>Updated:</strong> January 17, 2006</sub></p>
]]></content:encoded>
			<wfw:commentRss>http://forms.stefcameron.com/2007/01/10/setting-javascript-as-the-default-for-new-forms/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

