Using date/time fields

If you want to provide the ability to record the date, the time, or both in a form, add a date/time field to the form. The value in a date/time field can be formatted and displayed according to predefined patterns and according to the locale specified for the field.

For example, you can add a date/time field to your form design so that the user can enter the date or select it from a calendar window.

After you add a date/time field to the form design, you can edit the caption text and manipulate the object’s properties in the Field, Value, and Binding tabs of the Object palette. You can define these properties:

  • Change the caption for the field. See Formatting captions .

  • Set a border style for the field. See To set the border style .

  • Define the field as visible, invisible, or hidden. See Making objects visible, invisible, or hidden .

  • Specify a locale for the field. See To specify a locale (language and country or region) for an object .

  • Specify the comb format for the field. See Using text fields .

  • Specify that Designer use the horizontal length of the text field to determine the maximum number of characters and numbers to allow.

  • Define the display pattern.

  • Define the edit pattern (which is the format in which the date is entered).

  • Specify an initial default value to display.

  • Define a run-time property (for example, insert the date and time on which the form is rendered).

  • Define the validation pattern.

  • Choose whether to display the date, the time, or both.

  • Specify a data-binding pattern.

  • Specify a binding method for storing and retrieving bound data.

Date/time fields support scripting and calculations. If a user is to supply data, you can define whether the input is recommended or required, and you can set up messages to prompt users appropriately. All user input may be validated through scripting.

To add current date fields

You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.

Note: When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.
  1. In the Object Library palette, click the Standard category and drag a Date/Time Field object onto the form design.

  2. In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.

  3. Select the Runtime Property option.

  4. View the form in the Preview PDF tab.

To define the behavior of date/time fields

  1. In the Object palette, click the Value tab. Select one of these options:

    • To allow users to choose whether to enter data, select User Entered - Optional.

    • To prompt users to enter data and make the field recommended, select User Entered - Recommended and type a custom message in the Empty Message box.

    • To prompt users to enter data and make the field required, select User Entered - Required and type a custom message in the Empty Message box.

    • To make the field read only and display a data value that is calculated and displayed through an attached script, select Calculated - Read Only. Users cannot edit the calculated value.

    • To make the field editable and display a data value that is calculated and displayed through an attached script, select Calculated - User Can Override. Users can edit the value if the calculation script has been written to accept the input. If a user does edit the calculated value, the custom message you specify in the Override Message box appears.

    • To make the field read only and display a data value that is merged or calculated and displayed at run time, select Read Only. Users cannot edit the value.

  2. If the value is recommended or required, type a prompt in the Empty Message box.

  3. If the value will be calculated, attach the calculation script to the object by using the Script Editor.

  4. (Optional) If a calculated value can be overridden, type a message into the Override Message box.

    You can dynamically populate a validation pattern or script message with a value from a data source. This allows you to ensure that users enter the correct value in the field.

To define custom data-binding properties for date/time fields

Binding options enable you to build a form that captures data for enterprise infrastructures and/or use an external data source to populate a form at run time. Set data-binding properties in the Binding tab of the Object palette.

  1. Select the date/time field.

  2. Enable the form to connect to the data source when the form is opened.

  3. Bind the field to its corresponding data node. For information about how to bind objects to a data source, see Binding fields to a data source .

To specify the data to display in date/time fields

You can choose to display the date, the time, or both.

  1. In the Object palette, click the Binding tab.

  2. From the Data Format list, specify what to display in the field:

    • Date Specifies the object as a date.

    • Time Specifies the object as a time.

    • Date and Time Specifies the object as a date and time.

To define the pattern for displaying date/time fields

  1. In the Object palette, click the Field tab.

  2. Click Patterns > Display.

  3. In the Select Type list, select the pattern used to display data in the date/time field.

    Note: To display all date, time, and date/time formats in the Select Type list, you must first select Date and Time in the Data Format list of the Binding tab in the Object palette.

To specify the comb format for date/time fields

Use the comb format when you want to separate numbers added to date/time fields by border lines.

  1. In the Object palette, click the Field tab.

  2. Select Comb of Characters to includes border lines that separate each number within the date/time field.

  3. Enter how many numbers will be separated by border lines within date/time text field.

To limit the numbers in date/time fields

You can limit how many numbers can be entered in date/time field by specifying that Designer use the horizontal length of the date/time field to determine how many numbers to allow.

In the Object palette, click the Field tab and select Limit Length to Visible Area.

// Ethnio survey code removed