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. A tooltip can also be specified as a key to a lang file entry but is optional. 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
languagejava
titleModel object attribute
linenumberstrue
 persistent object Farmer {
    .
    .
    // What day and time did the farmer last visit a shop 
    datetime lastShopVisit;
    .
    .
}


Code Block
languagexml
titleView XML
linenumberstrue
<datefield label="datefield.last_shop_visit">
    <binding variable="farmer">
        <attribute name="lastShopVisit"/>
    </binding>
</datefield>


Code Block
languagejava
titleBacking unit
linenumberstrue
Farmer farmer;

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


Code Block
titleen.lang file entry
 datefield.last_shop_visit = Last shop visit:


Info
title<datefield> bound to datetime type example screenshots

 


 


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
languagexml
titleView XML
linenumberstrue
 <datefield label="datefield.date_of_stocktake">
    <binding variable="selectedDateOfStocktake"/>
</datefield>


Code Block
languagejava
titleBacking unit
linenumberstrue
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
titleen.lang file entry
 select.date_of_stocktake = Date of Stocktake:


Info
title<datefield> bound to date type example screenshots

 

 

 

 




Additional Mentions and References