Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Table of Contents |
---|
Description
The date field input widget allows for the capturing of data for both date
and datetime
types.
The widget allows for binding to a basic data type variable directly or to an object instance attribute.
The appearance of the widget is slightly altered depending on the type of variable that it is bound to. For date
types a calendar will be presented from which to select a date. For datetime
types two additional fields for the hour and minute is presented in addition to the calendar.
The title is specified as a key to a lang file entry and is required. Visibility bindings are also supported.
Example
Binding to a datetime
type
The abbreviated code snippets and screenshot below shows the use of <datefield/>
with a value binding to an object instance attribute that has a datetime
type.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
persistent object Farmer { . . // What day and time did the farmer last visit a shop datetime lastShopVisit; . . } |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<datefield label="datefield.last_shop_visit"> <binding variable="farmer"> <attribute name="lastShopVisit"/> </binding> </datefield> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Farmer farmer; void init() { farmer = Farmer:new(); . . } |
Code Block | ||
---|---|---|
| ||
datefield.last_shop_visit = Last shop visit: |
Info | ||
---|---|---|
| ||
|
Binding to a date
type
The abbreviated code snippets and screenshot below shows the use of <datefield/>
with a value binding to an object instance attribute that has a date
type.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<datefield label="datefield.date_of_stocktake"> <binding variable="selectedDateOfStocktake"/> </datefield> |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
date selectedDateOfStocktake; void init() { . . selectedDateOfStocktake = Mez:now(); } |
Notice from the above code snippet how Mez:now
is used to set an initial value for the selectedDateOfStocktake
variable is set in the init function. If the init function is specified in the view, this initial value will be set when the view loads and will be displayed in the widget.
Code Block | ||
---|---|---|
| ||
select.date_of_stocktake = Date of Stocktake: |
Info | ||
---|---|---|
| ||
|
Additional Mentions and References
- Devoted section in the Helium Tutorial Lesson 7: Dynamic Tables
- Helium DSL and View Quick Reference