XFDL options and array elements

In the XFDL language, options define the item characteristics. Options themselves may contain any number of array elements, which further define the characteristics. Options can contain simple character data, computes or computations, or array elements.

Syntax

For simple character data content:

   <optionTag>character data content</optionTag>

For computed options:

   <optionTag compute="expression">character data content</optionTag>

For array options:

   <optionTag>
      <!-- suboption elements -->
   </optionTag>

An option defines a characteristic given to a form, a page, or an item. For example, the bgcolor option set at the form or page global level defines the background color of the pages of the form itself whereas a bgcolor option set at the item level defines the background color for the containing item. Some form and page global options define defaults for item-level options. For example, if an item has no fontinfo option, then the fontinfo in the page globals are used, and if the page globals contain no fontinfo option, then the fontinfo in the form globals (and the form global fontinfo has implied defaults if it is not specified).

The definition of an option consists of content between start and end tags. The element tag defines the type of option. This type must be one of the option types defined in this specification, or a user-defined option that follows the rules in the "custom option" description in this specification.

Note: For information about XForms options, refer to XForms options.

Option content

The content of an option can take one of three formats: simple character data, a compute, or an array of subordinate XML elements. Computes are identified by a compute attribute, while arrays are identified by the presence of subordinate elements.
Simple character data
The default is simple character data, in which case the option must contain text with no child elements. For example:
   <value>This is the value</value>
Computes

If the character content must be computed, then the computational expression appears in the start tag of the option in an attribute named compute. If the XFDL computation system has been applied to the form, then the option also contains simple character data for the current computed value of the expression. For example:

   <value compute="price1Field.value + price2Field.value * '0.07'">205.68
      </value>

It is typical to have a form run its computes on a client machine, then have server modules simply read the current values, ignoring the content of the compute attributes. In essence, an application can ignore the compute attributes unless it must change element values that are referenced by computed options. See section XFDL compute system for details on how the compute expression is represented.

Arrays
The third case for an option's content is an array of subordinate elements. The option must contain one or more array elements. For example:
   <itemlocation>
      <under>nameField</under>
      <after>addressField</after>
   </itemlocation>

Each array element may also contain an array. This recursive definition permits arbitrary depth for XFDL arrays.

XFDL assigns names to these array elements so that they are easier to reference.

Order of precedence of options

An option set at a lower level in the form hierarchy overrides a similar option set at a higher level. It overrides it for only the level it is in and any that come under it in the hierarchy. For example, the fontinfo option in the following example would override a global fontinfo setting for the page it is in, and also for any items in that page.

   <page sid="Page1">
      <global="global">
         <fontinfo>
            <fontname>Helvetica</fontname>
            <size>12</size>
            <effect>plain</effect>
         </fontinfo>
      </global>

Defining form global and page global options

Form global options are optional and must be defined in a <global> element in a <globalpage> element after the XFDL start tag and before the first <page> in a form. Page global options are optional and must be defined in a <global> element after the <page> start tag and before the first item in a page. To determine whether an option is a valid form global or page global option, see section Form globals.

Data type designators used in option descriptions

XFDL defines a set of data types that describe type of content allowed in an option. Each option description in this specification uses one or more of the following data type designators:

char
A single ASCII character.
string
A series of ASCII characters.
color
A color name, an RGB triplet, or a hexadecimal RGB value that represents the color.

The syntax of an RGB triplet is:

   <bgcolor>Red, Green, Blue</bgcolor>

Where red, green, and blue are values from 0 to 255.

The syntax for a hexadecimal RGB value is:

   <bgcolor>#RRGGBB</bgcolor>

Where RR, GG, and BB are the hexadecimal values for the red, green, and blue settings.

coordinate
Whole number in the range 0 to 1,000 representing one coordinate of a position.
integer
Positive or negative whole number in the range -32,768 to 32,767.
unsigned byte
Whole number in the range 0 to 255.
unsigned
Whole number in the range 0 to 65,535.
numeric boolean
A value of 0 or 1, in which 0 is false and 1 is true.