Versions Compared
compared with
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 | ||||
---|---|---|---|---|
| ||||
<datefield label="select.date_of_stocktake"> <binding variable="selectedDateOfStocktake"/> </datefield> |
Code Block | ||||
---|---|---|---|---|
| ||||
date selectedDateOfStocktake; void init() { selectedDateOfStocktake = Mez:now(); } |
Binding to a unit variable attribute
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<info label="info.first_name"> <binding variable="farmer"> <attribute name="firstName"/> </binding> </info> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Farmer farmer; void init() { Farmer = Farmer:new(); . . } |
Binding to a function
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<info label="info.email_address"> <binding function="getSystemAdminEmailAddress"/> </info> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
SystemAdmin currentSystemAdminUser; void init() { currentSystemAdminUser = SystemAdmin:user(); . . } string getSystemAdminEmailAddress() { return currentSystemAdminUser.emailAddress; } |
Additional Mentions and References
- Used in multiple lessons in the Helium Tutorial with first mention in Lesson 1: A Basic Helium App
- Multiple examples in the Helium Quick Reference