Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

'Debugging' Category Archive

Acrobat JavaScript Debugger on XFA Forms

Many of you have been requesting some debugging features for XFA Forms (and I’m sure many more of you just haven’t voted for it yet). It so happens that Acrobat Pro has a JavaScript Debugger which can be used — to a limited extent — with XFA Forms. See John Brinkman’s post to learn more about it — thanks John!

As he puts it, there are limitations, the biggest ones of them being, in my opinion, the inability to debug script objects and the inability to retain breakpoints between debugging sessions. Nonetheless, this tool can give you way more insight than the good old “JavaScript Console + saveXML(‘pretty’)” combination can in certain cases, and it does it in a nice tree to boot!


Posted by Stefan Cameron on March 12th, 2010
Filed under Acrobat,Debugging,Scripting,Tutorials,XFA

Testing HTTP Submit Buttons

While recently helping a few people with some issues related to HTTP submissions from XFA forms, I ended-up creating new Data Service that helps with testing HTTP Submit Buttons.

The service is quite simple: It displays what you submit to it. Since Designer’s “PDF Preview” tab is actually an instance of Internet Explorer hosting a PDF version of the form you’re previewing (a temporary PDF if your form is saved as an XDP or is new), the results are conveniently displayed within the tab itself after clicking on the submit button.

To use the service, simply use either an http submit button (or a regular button with its “Object palette > Field tab > Control Type property” set to “Submit”) and set its URL to:

http://forms.stefcameron.com/services/http-submit-test/

The idea is to use this service as a means to test/debug your forms before spending time writing the actual server code that will receive the data. You can also use it to ensure that you are submitting the correct data to a third-party service (for which you don’t control the server-side code).

Continue reading…


Posted by Stefan Cameron on December 16th, 2009
Filed under Data Binding,Debugging,Tables,Tutorials,XFA

Tip: Pretty XML Strings

I regularly use the saveXML() method, available on all node class-based objects, as a way to debug my forms (think of it as a type of introspection technique). The method outputs a string representation of the XML content of the node in question, which helps when attempting to discover the underlying object structure without a debugger…

For example, say you have a simple form with a text field and a numeric field. The following statement will output the form’s data to the JavaScript Console in Acrobat:

console.println(xfa.datasets.data.saveXML());

The result, however, isn’t very readable:

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
><form1
><TextField1
>asdf</TextField1
><NumericField1
>1234</NumericField1
></form1
></xfa:data
>

Though I had been using saveXML() for quite some time, I hadn’t realized that it actually takes an optional parameter, a string with a value of “pretty”, that results in much nicer output.

console.println(xfa.datasets.data.saveXML('pretty'));

results in the following pretty/readable output:

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
   <form1>
      <TextField1>asdf</TextField1>
      <NumericField1>1234</NumericField1>
   </form1>
</xfa:data>

Posted by Stefan Cameron on August 19th, 2009
Filed under Debugging,Scripting,Tips

FormFeed Debugging Tips

My friend John Brinkman has posted a really good list of handy form development and debugging tips. Check it out! These tips could save you a lot of time and effort. I use them all the time when I work on forms with Designer, Acrobat and LiveCycle Forms.

One other nice thing about console.println() for outputting debug information to the JavaScript Console in Acrobat is that these strings are also output to the Flash Log when you run form guides generated with LiveCycle ES Update 1 (8.2.1) using the Flash Debug Player. (The 3rd part of my MAX 2008 Tutorial series has details on how to set this up under the “Flash Log and Debug Players” section.)


Posted by Stefan Cameron on May 27th, 2009
Filed under Acrobat,Debugging,Designer,Form Guides,Script Editor,Tips

Hidden JavaScript Exception Information

In case you missed it, John Brinkman posted a great article on how to extract more information from a JavaScript exception (caught in a try/catch block). Have a look — there’s lots of useful information in the exception object and it’s just a matter of knowing how to expose it. It could save you hours of debugging time!


Posted by Stefan Cameron on March 13th, 2009
Filed under Debugging,Scripting