NextGen Knowledge Center

CALENDAR Function

Use:Displays a calendar for the user to select a date.
Syntax:
{CALENDAR( «calling field» , «do listpick» , «default» , «caption» )}
Arguments:

«calling field» (optional)
    The name of the field that receives the date value, or for a list pick event, the template field that the pick is made from
«do listpick» (optional)
    1 = true
    0 = false
«default» 
    Default value displayed in the calendar when it opens. 
    NextGen Healthcare recommends that you use the field that receives the date value as the default value. If this field already contains a date, the calendar displays that date when it opens. If the field is blank, the calendar displays the current date when it opens.
    If a user opens the calendar but then clicks the Cancel button or the Close window X button, the following results apply: If the field was blank, it remains blank; if the field has an existing value, that value is retained. 
    Note: If you use the @Today function as the default value, the current date is entered in the receiving field if you cancel or close the calendar window without selecting a date. 
«caption» (optional)
    Title of the calendar
Returns:A date value
Example 1:

Default value, no list pick
Field = txt_date_field
{CALENDAR( {template_name_.txt_date_field}, 0, {template_name_.txt_date_field}, "Please select a date" )}

Result: The calendar appears.

The selected date is entered into the txt_date_field.

Example 2:

List pick, no default value
Fields = txt_date_field, list pick event on txt_another_field
{CALENDAR({template_name_.txt_another_field}, 1, , "Choose a date" )}
Alert to be triggered when a number is selected

Result: The calendar appears.

The selected date is entered into the txt_date_field. If the result is greater than zero, the list pick event on txt_another_field displays an alert.