Archive for November, 2007

A Shortcut for Inserting SOM Expressions into your Script

The XFA scripting model can be a bit… overwhelming… sometimes.  It can be hard to figure out what SOM expression you need need to use.  But there is an alternative to typing out a long, many-layered-SOM-expression.  While typing in the script editor, if you hold down the CTRL key and click on an object on the canvas, the object’s SOM expression will be inserted into your script.  The SOM expression will be relative to the object hosting the script. 

If you want the absolute SOM, then hold down CTRL+SHIFT and click on the object.

Please note that this trick only works when clicking on objects on the canvas, not in the hierarchy dialog.

xfa.host.setFocus()

Did you know that starting with version 8.1, the setFocus() method can accept either a SOM expression or a node object?

For example,

xfa.host.setFocus(this);

xfa.host.setFocus(this.somExpression);