<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Form Variable Tip</title>
	<atom:link href="http://forms.stefcameron.com/2006/07/16/form-variable-tip/feed/" rel="self" type="application/rss+xml" />
	<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/</link>
	<description>Building intelligent forms using Adobe LiveCycle Designer</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:32:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5102</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Tue, 24 Aug 2010 12:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5102</guid>
		<description>@Hai,

You could always serialize your complex object to a string and rebuild it after data import.</description>
		<content:encoded><![CDATA[<p>@Hai,</p>
<p>You could always serialize your complex object to a string and rebuild it after data import.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hai</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5101</link>
		<dc:creator>Hai</dc:creator>
		<pubDate>Mon, 16 Aug 2010 16:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5101</guid>
		<description>Hi I&#039;m trying to do something similiar with form variables but as we mentioned in the post, for variables get reset after import.  It was mentioned to use Doc.createDataObject.

I&#039;m actually trying to save a complex object instead of a string.  Is there a way I can do this?
I particular, I&#039;m trying to keep track of an array of bookmark objects.

thanks
Hai</description>
		<content:encoded><![CDATA[<p>Hi I&#8217;m trying to do something similiar with form variables but as we mentioned in the post, for variables get reset after import.  It was mentioned to use Doc.createDataObject.</p>
<p>I&#8217;m actually trying to save a complex object instead of a string.  Is there a way I can do this?<br />
I particular, I&#8217;m trying to keep track of an array of bookmark objects.</p>
<p>thanks<br />
Hai</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5100</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Tue, 14 Apr 2009 19:55:38 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5100</guid>
		<description>Ron,

Unfortunately, when you merge data into the form, unless you&#039;re not replacing the form&#039;s current data set (which you need to do in order to get bindings to act on the new data you&#039;re importing), the form&#039;s state gets reset. Furthermore, the call to import data doesn&#039;t occur immediately which means that even if you created local variables to hold the global variable values in order to re-set the global variables after importing the new data, you would no longer have access to those local variables after the import occurs.

The only way to &quot;persist&quot; your global variable values is to store them in the data, merge the combined data into the form, and retrieve them from there afterward. The problem with xfa.host.importData() is that it doesn&#039;t give you an opportunity to edit the XML data prior to merge it into the form.

You could perhaps use Acrobat&#039;s &lt;a href=&quot;http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.450.html&quot; rel=&quot;nofollow&quot;&gt;Doc.createDataObject()&lt;/a&gt; API prior to calling xfa.host.importData() in order to temporarily store the values of your global variables and then, if your global variables are reset the next time you get their values, you would know to reload them from the special Data Object you stored them in... Of course, this would only work if your form is used in Reader or Acrobat (not if it&#039;s rendered as HTML or as a Form Guide).</description>
		<content:encoded><![CDATA[<p>Ron,</p>
<p>Unfortunately, when you merge data into the form, unless you&#8217;re not replacing the form&#8217;s current data set (which you need to do in order to get bindings to act on the new data you&#8217;re importing), the form&#8217;s state gets reset. Furthermore, the call to import data doesn&#8217;t occur immediately which means that even if you created local variables to hold the global variable values in order to re-set the global variables after importing the new data, you would no longer have access to those local variables after the import occurs.</p>
<p>The only way to &#8220;persist&#8221; your global variable values is to store them in the data, merge the combined data into the form, and retrieve them from there afterward. The problem with xfa.host.importData() is that it doesn&#8217;t give you an opportunity to edit the XML data prior to merge it into the form.</p>
<p>You could perhaps use Acrobat&#8217;s <a href="http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.450.html" rel="nofollow">Doc.createDataObject()</a> API prior to calling xfa.host.importData() in order to temporarily store the values of your global variables and then, if your global variables are reset the next time you get their values, you would know to reload them from the special Data Object you stored them in&#8230; Of course, this would only work if your form is used in Reader or Acrobat (not if it&#8217;s rendered as HTML or as a Form Guide).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ron</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5099</link>
		<dc:creator>Ron</dc:creator>
		<pubDate>Wed, 08 Apr 2009 18:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5099</guid>
		<description>Hi,
  This blog is really very much interesting, i can&#039;t resist to stop asking my question to everyone.

Am having an import button, with the code call to xfa.host.import(); function, But after the import operation, all my variables declared globally are lost. Is there any way i can sustain them to perform operations, on the imported XML.
Where should declare the variables, to be totally global?

Thanks,
Ron.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
  This blog is really very much interesting, i can&#8217;t resist to stop asking my question to everyone.</p>
<p>Am having an import button, with the code call to xfa.host.import(); function, But after the import operation, all my variables declared globally are lost. Is there any way i can sustain them to perform operations, on the imported XML.<br />
Where should declare the variables, to be totally global?</p>
<p>Thanks,<br />
Ron.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5098</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Fri, 09 Jan 2009 20:25:10 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5098</guid>
		<description>Thanks for your ideas Stefan.  I may end up having to move to Adobe LiveCycle Forms.  You do a great job on this site.</description>
		<content:encoded><![CDATA[<p>Thanks for your ideas Stefan.  I may end up having to move to Adobe LiveCycle Forms.  You do a great job on this site.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Jeske</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5097</link>
		<dc:creator>Tim Jeske</dc:creator>
		<pubDate>Thu, 08 Jan 2009 01:44:12 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5097</guid>
		<description>Thanks Very Much!  I got my answer straightaway!

T</description>
		<content:encoded><![CDATA[<p>Thanks Very Much!  I got my answer straightaway!</p>
<p>T</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5096</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Thu, 08 Jan 2009 01:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5096</guid>
		<description>Tim Jeske,

It&#039;s true you did say, &quot;scripting in &lt;b&gt;PDF&lt;/b&gt;.&quot; I answered the question as though you were creating a PDF form using Adobe&#039;s LiveCycle Designer. Sorry about that. I guess you&#039;re trying to create an AcroForm Form (just a form in PDF, no XFA involved).

In that case, I&#039;m afraid I&#039;m not in a very good position to help you out. I would suggest you ask your AcroForm-related questions on the &lt;a href=&quot;http://www.acrobatusers.com/forums/aucbb/&quot; rel=&quot;nofollow&quot;&gt;Acrobat Users&lt;/a&gt; forum.</description>
		<content:encoded><![CDATA[<p>Tim Jeske,</p>
<p>It&#8217;s true you did say, &#8220;scripting in <b>PDF</b>.&#8221; I answered the question as though you were creating a PDF form using Adobe&#8217;s LiveCycle Designer. Sorry about that. I guess you&#8217;re trying to create an AcroForm Form (just a form in PDF, no XFA involved).</p>
<p>In that case, I&#8217;m afraid I&#8217;m not in a very good position to help you out. I would suggest you ask your AcroForm-related questions on the <a href="http://www.acrobatusers.com/forums/aucbb/" rel="nofollow">Acrobat Users</a> forum.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Jeske</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5095</link>
		<dc:creator>Tim Jeske</dc:creator>
		<pubDate>Wed, 07 Jan 2009 13:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5095</guid>
		<description>BTW ... I don&#039;t know whether it makes any difference or not and I probably should have mentioned this earlier but I&#039;m doing this in Acrobat Pro 6.0.  Is that too ancient for this kind of effort?</description>
		<content:encoded><![CDATA[<p>BTW &#8230; I don&#8217;t know whether it makes any difference or not and I probably should have mentioned this earlier but I&#8217;m doing this in Acrobat Pro 6.0.  Is that too ancient for this kind of effort?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Jeske</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5094</link>
		<dc:creator>Tim Jeske</dc:creator>
		<pubDate>Wed, 07 Jan 2009 12:22:25 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5094</guid>
		<description>Thank you Stefan,  I am beginning to see some light but am still unclear on a couple things.

My form currently contains this line (for example)

____ adults at $75 = __________

What I want to happen is for the user to enter a number (n) in the first blank (field name &quot;reg1&quot;) and have the second blank (field name &quot;reg1total&quot;) display the product of n*75.

A calculation expression of: reg1 * 75 in field &quot;reg1total&quot; does not work.  If I understand your instructions correctly, it would seem as though I need to create a third field for this line (let&#039;s call it &quot;regrate1&quot; which contains the number 75 and then create a script for &quot;reg1total&quot; which reads:  reg1 * regrate1  Is that correct?  If it is, I know how to create the field and make it &quot;read only&quot; but I&#039;m uncertain how to pre-populate it with the number 75.

Thanks for your patience!

T</description>
		<content:encoded><![CDATA[<p>Thank you Stefan,  I am beginning to see some light but am still unclear on a couple things.</p>
<p>My form currently contains this line (for example)</p>
<p>____ adults at $75 = __________</p>
<p>What I want to happen is for the user to enter a number (n) in the first blank (field name &#8220;reg1&#8243;) and have the second blank (field name &#8220;reg1total&#8221;) display the product of n*75.</p>
<p>A calculation expression of: reg1 * 75 in field &#8220;reg1total&#8221; does not work.  If I understand your instructions correctly, it would seem as though I need to create a third field for this line (let&#8217;s call it &#8220;regrate1&#8243; which contains the number 75 and then create a script for &#8220;reg1total&#8221; which reads:  reg1 * regrate1  Is that correct?  If it is, I know how to create the field and make it &#8220;read only&#8221; but I&#8217;m uncertain how to pre-populate it with the number 75.</p>
<p>Thanks for your patience!</p>
<p>T</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2006/07/16/form-variable-tip/#comment-5093</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Wed, 07 Jan 2009 02:28:28 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/blog/?p=26#comment-5093</guid>
		<description>Tim Jeske,

I&#039;ll try to explain this as simply as I can. Typically, in a form like yours, there&#039;s a quantity field, a cost field and a total field. Let&#039;s say there are 3 rows and also a grand total field that sums all of the total fields (note that all fields here are numeric fields):

&lt;pre&gt;&lt;code&gt;quantity1   cost1   total1
quantity2   cost2   total2
quantity3   cost3   total3
                    ------
                    grandTotal&lt;/code&gt;&lt;/pre&gt;

Usually, the cost fields will be read-only (&quot;Object palette &gt; Value tab &gt; Type property&quot; set to &quot;Read-Only&quot;) since the price is fixed and the total and grandTotal fields will be read-only since they are calculated fields (&quot;Object palette &gt; Value tab &gt; Type property&quot; set to &quot;Calculated - Read-Only&quot;). You then need some simple FormCalc scripts to make this all come together.

For the total1 field, you would set its Calculate script (using the Script Editor palette) to the following FormCalc expression (make sure the script language is set to &quot;FormCalc&quot;):

&lt;pre&gt;&lt;code&gt;quantity1 * cost1&lt;/code&gt;&lt;/pre&gt;

and similarly for total2 and total3.

Finally, for the grantTotal field, you would set its Calculate script to the following FormCalc expression:

&lt;pre&gt;&lt;code&gt;SUM(total1, total2, total3)&lt;/code&gt;&lt;/pre&gt;

With these simple scripts set, whenever the value of a dependent field changes (i.e. total1 depends on quantity1 and grantTotal depends on total1-3), the values of the calculated fields will change accordingly.</description>
		<content:encoded><![CDATA[<p>Tim Jeske,</p>
<p>I&#8217;ll try to explain this as simply as I can. Typically, in a form like yours, there&#8217;s a quantity field, a cost field and a total field. Let&#8217;s say there are 3 rows and also a grand total field that sums all of the total fields (note that all fields here are numeric fields):</p>
<pre><code>quantity1   cost1   total1
quantity2   cost2   total2
quantity3   cost3   total3
                    ------
                    grandTotal</code></pre>
<p>Usually, the cost fields will be read-only (&#8220;Object palette > Value tab > Type property&#8221; set to &#8220;Read-Only&#8221;) since the price is fixed and the total and grandTotal fields will be read-only since they are calculated fields (&#8220;Object palette > Value tab > Type property&#8221; set to &#8220;Calculated &#8211; Read-Only&#8221;). You then need some simple FormCalc scripts to make this all come together.</p>
<p>For the total1 field, you would set its Calculate script (using the Script Editor palette) to the following FormCalc expression (make sure the script language is set to &#8220;FormCalc&#8221;):</p>
<pre><code>quantity1 * cost1</code></pre>
<p>and similarly for total2 and total3.</p>
<p>Finally, for the grantTotal field, you would set its Calculate script to the following FormCalc expression:</p>
<pre><code>SUM(total1, total2, total3)</code></pre>
<p>With these simple scripts set, whenever the value of a dependent field changes (i.e. total1 depends on quantity1 and grantTotal depends on total1-3), the values of the calculated fields will change accordingly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

