Binding Web Layout to Component Structure

Binding refers to the way in which layout elements are connected to data structures and triggers in the component structure. It ensures that data is displayed by the appropriate HTML elements in the web page, and that the correct trigger is executed when data in a field is changed.

Uniface web applications make use of late binding, meaning that the connection between the component structure and HTML element is only established at runtime. However, the binding must be defined in the web layout definition, used to generate the runtime web page, and this does not happen automatically. Thus, if you add a field that needs to be available in the generated web page to the component structure, you must also add it to the web layout with the required binding information.

Binding for Dynamic Server Pages

For dynamic server pages, the binding information is defined by the id attribute for the bound HTML element, such as , <div> or <tr>. The id attribute is completely standards-compliant, so it does not pose a problem for XHTML editors.

DSP Binding
Component Object Binding Attribute Syntax
Entity id="uent:Entity.Model"
Occurrence id="uocc:Entity.Model"

Or:

id="uocs:Entity.Model"

id="uoce:Entity.Model"

Field id="ufld:Field.Entity.Model"
Label id="ulbl:Field.Entity.Model"

For example, the following input element is bound to the SHIPTO field of the CUST_ORDER.SALES entity:

<input id="ufld:SHIPTO.CUST_ORDER.SALES" value="Input Element"/>

Occurrences can be bound to a single element, or they can be bound to a range of elements. This can be useful in an HTML table where each occurrence occupies a fixed number of rows. The first of these rows would be a <tr> element bound using the uocs: prefix, and the last of them using the uoce: prefix.

DSP web layout showing ID-based binding

HTML layout of DSP component

Binding for Static Server pages

For static server pages, binding information is provided in the name attribute of Uniface-specific XHTML tags such as <x-subst> and <x-occurrence>. The use of Uniface-specific tags makes it more difficult to use a standard XHTML editor, because it will not recognize these tags.

Static Server Page Binding
Component Object Binding Attribute Syntax
Entity

<x-entity name="Entity.Model">

Occurrence <x-occurrence name="Entity.Model">
Field <x-subst type="text" name="Field.Entity.Model" sync="1">
<input name="Field.Entity.Model" value="Input" type="text" />
</x-subst>
Label <x-subst type="label" name="Field.Entity.Model">
<label>Label</label>
</x-subst>

USP web layout showing name-based binding Binding in web layout of static server page