Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

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

Code Block
languagexml
linenumberstrue
<datefield label="select.date_of_stocktake">
    <binding variable="selectedDateOfStocktake"/>
</datefield>
Code Block
languagejava
linenumberstrue
date selectedDateOfStocktake;

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

 

Binding to a unit variable attribute

Code Block
languagexml
titleView XML
linenumberstrue
<info label="info.first_name">
    <binding variable="farmer">
        <attribute name="firstName"/>
    </binding>
</info>
Code Block
languagejava
titleBacking unit
linenumberstrue
Farmer farmer;

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

 

Binding to a function

Code Block
languagexml
titleView XML
linenumberstrue
<info label="info.email_address">
    <binding function="getSystemAdminEmailAddress"/>
</info>
Code Block
languagejava
titleBacking unit
linenumberstrue
SystemAdmin currentSystemAdminUser;

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

 

Additional Mentions and References