Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

'Tips' Category Archive

Show the List of a Drop Down List

Did you know that the list portion of a drop down list field can be displayed programmatically? You can set focus to the field and force its drop list to be displayed all in a single API call: -- deprecated since XFA 2.6

where @object is a reference to the drop down list field and @string is the SOM expression of the drop down list field.; // set focus/show the drop list

The second form of the API has been deprecated since XFA 2.6 which means that since Designer 8.1, it is preferred to use the first form which takes a reference to the field rather than its SOM expression.

If you’re using Designer 8.0 or earlier, you can get the SOM expression of any field by using its somExpression property:

This works in both JavaScript and FormCalc with the same syntax.

Now if only there was a way to programmatically show the drop calendar of a date/time field…

Posted by Stefan Cameron on May 31st, 2010
Filed under Scripting,Tips,Tutorials,XFA

Tip: Accessing Form Properties Preview Tab

Did you know you could quickly access the Preview tab in the Form Properties dialog from the PDF Preview tab’s context menu?

My friend Angie Okamoto (Easel Solutions) was the one who originally pointed this out to me. It’s incredibly useful, especially when you’re switching between various preview data files (or options like interactive vs non-interactive), because it loads the dialog and activates the Preview tab in a single step. This saves both mouse travel time and one click which adds-up to a lot, if you do this frequently.

Continue reading…

Posted by Stefan Cameron on February 11th, 2010
Filed under Designer,Tips

Tip: Inserting Line Breaks in Text

Did you know that you could insert a line break, as opposed to a paragraph break, in between two lines in a text object using the [Shift + Enter] keyboard sequence?

When editing the contents of a text object, pressing the [Enter] key will produce a paragraph break which means that any Above and/or Below Spacing you have specified will come into effect, amongst other paragraph formatting-related properties. Under the hood, the effect is the insertion of a “new line” character (\n) in a plain text object or a new <p> tag in a rich (XHTML) text object.

Sometimes, however, you need to break a line without producing a new paragraph. For example, you might have a long URL to insert and, given its position within the contents, it ends-up being broken onto another line and you would prefer to keep it on a single line, yet part of the same paragraph. To do this, use the [Shift + Enter] keyboard sequence. The result is a “soft” break to another line without moving to a new paragraph. Under the hood, this translates into the insertion of a U+2029 Unicode break character in plain text or a <br> tag in rich (XHTML) text.

Those of you using a version of Designer which precedes the 8.2.1 release should note that when using [Shift + Enter] in a plain text object, the contents of the object gets converted into rich text since previous versions of Designer would always use the <br> tag to denote a line break. Designer 8.2.1 coincided with the release of Acrobat/Reader 9.0 which provided improvements to the Text Engine in order to support the plain text U+2029 Unicode break character.

Continue reading…

Posted by Stefan Cameron on January 29th, 2010
Filed under Acrobat,Designer,Tips,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:


The result, however, isn’t very readable:

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa=""

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.


results in the following pretty/readable output:

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="">

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