<binding/>

 

Description

The binding element provides a mechanism in Helium with which to bind values submitted from input widgets to unit variables of a base type or attributes of object instance unit variables. It also provides a way to bind functions to widgets in order to use the values returned from these functions in the widgets. 

 

 

Example

Binding directly to a unit variable

<datefield label="select.date_of_stocktake">
    <binding variable="selectedDateOfStocktake"/>
</datefield>
date selectedDateOfStocktake;

void init() {
    selectedDateOfStocktake = Mez:now();
}

 

Binding to a unit variable attribute

View XML
<info label="info.first_name">
    <binding variable="farmer">
        <attribute name="firstName"/>
    </binding>
</info>
Backing unit
Farmer farmer;

void init() {
    Farmer = Farmer:new();
    .
    .
}

 

Binding to a function

View XML
<info label="info.email_address">
    <binding function="getSystemAdminEmailAddress"/>
</info>
Backing unit
SystemAdmin currentSystemAdminUser;

void init() {
    currentSystemAdminUser = SystemAdmin:user();
    .
    .
}
string getSystemAdminEmailAddress() {
    return currentSystemAdminUser.emailAddress;
}

 

Additional Mentions and References