Defining a gICAPI web component in forms

When defining a gICAPI web component in a form specification file, you can also provide a sizing policy and define additional properties.

Adding a WEBCOMPONENT to the form file

To define an gICAPI web component field, add a form field with the WEBCOMPONENT item type and the COMPONENTTYPE attribute. The COMPONENTTYPE attribute is mandatory when defining a gICAPI web component; it defines the root HTML file name describing the gICAPI web component.

A web component field is typically defined with the FORMONLY prefix, as the data for the field is rarely stored in a database column.

Sizing policy for web component fields

Web components are usually complex widgets displaying detailed information, such as charts, graphs, or calendars, which are generally resizable. Use the appropriate form item attributes to get the expected layout and behavior. For more details, see Controlling the web component layout.

Defining gICAPI web component properties

Since web component field definitions are generic, you must use the PROPERTIES attribute to set specific parameters for the component.

The PROPERTIES attribute can define a list of:

  • simple properties ( name = value ),
  • array properties ( name = ( value1, value2, ... ) )
  • map/dictionary properties ( name=( name1=value1,name2=value2, ... ) )

where name is a simple identifier, and where values can be numeric or string literals.

Component properties defined in the PROPERTIES attribute are transmitted to the web component through the onProperty() method of the gICAPI object.

The name of a property defined in the PROPERTIES attribute is converted to lowercase by the form compiler. To avoid mistakes, a good programming pattern is to define properties in lowercase, in both the interface script and in the form definition file. Property names are not checked at compile time, so nonexistent or mistyped properties will be ignored at runtime.

Example

LAYOUT
GRID
{
[wc                       ]
[                         ]
[                         ]
[                         ]
[                         ]
}
END
END
ATTRIBUTES
WEBCOMPONENT wc = FORMONLY.mychart,
         COMPONENTTYPE = "3DCharts",
         STRETCH = BOTH,
         PROPERTIES = ( type = "bars",
                        x_label = "Months",
                        y_label = "Sales" );
END