Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

'Scripting' Category Archive

Multi-Selection List Schema Definition

After spending some time, recently, showing you how to connect your form to a schema and highlighting Designer’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 <value> nodes, once you think about it, their schema definition may not be obvious. When you’re working with XML data that isn’t governed by a schema and namespaces, it is perhaps easier to work with (i.e. accept) these <value> nodes however things change when you have a schema telling you how your data must be structured and scoped (with namespaces).

Continue reading…


Posted by Stefan Cameron on September 30th, 2009
Filed under Acrobat, Bugs, Data Binding, Scripting, Tutorials, XFA

Schema Metadata

My first tutorial on XML schemas explained how to connect your form to a schema however it did not show some of the Data View palette’s special features with respect to metadata in XML schemas.

Using metadata based on a combination of the XML Schema appInfo and Dublin Core title and description elements, you can influence how the Data Connection Wizard creates fields you drag and drop from the data connection tree into your form. You can also direct the Data View palette to show some of this information in the Schema Data Connection Tree that it displays.

Continue reading…


Posted by Stefan Cameron on August 28th, 2009
Filed under Data Binding, Designer, Scripting, 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

LC Designer ES2 Action Builder First Peek

Steve, on the LC Designer Team, has posted a good introduction to LC Designer ES2’s Action Builder feature. This feature is going to be very useful, especially if you’re not comfortable with writing scripts and need to get some basic but powerful logic to function properly. Actions will take care of it all for you so that you don’t have to write a line of code!

Check-out more posts on Actions and the Action Builder feature:

Aug 10, 2009 — Added links to more Action Builder posts from the LC Designer Team.
Aug 31, 2009 — Added links to more Action Builder posts from the LC Designer Team.


Posted by Stefan Cameron on August 6th, 2009
Filed under Designer, Scripting

More details about the next Designer

Mark Szulc has posted a nice article on a few more features you can look forward to in the next version of Designer. Since the new version is now in beta, as part of the LiveCycle ES2 Beta Program, we can start talking about what the team has been working on for the past year.

One feature I’m sure will help-out a lot of folks starting-out is Actions. With this feature, you can now tell Designer that you want to do things like “make {text field B} appear when {check box A} is checked” and it will do all the heavy lifting for you — no need to write the script you normally would’ve needed to (or even know how to script it yourself)! In fact, you may find this handy even if you’re an XFA form scripting veteran since you will no longer have to worry about scripting all the simpler things and spend more time on your advanced scripts.


Posted by Stefan Cameron on July 20th, 2009
Filed under Designer, Scripting