Validate Dates in Forms

You can use the Expression Editor to validate a date you enter in a form.

Suppose you have a form for creating a business object instance that has a Start Date and an End Date field. You want to be sure that the end date can't be earlier than the start date. To do this:
  1. In the Page Designer, select the Input Date component for End Date in the form.
  2. In the General tab of the Properties pane, click the fx icon for the the Min property.

  3. In the left panel, expand the business object and double-click startDate.
    The expression $variables.expenseReport.startDate is displayed in the editor pane (where expenseReport is the name of the page variable).
  4. Click Save.
    The expression is displayed in the Min property, surrounded by double brackets.
As a result, the DatePicker for the End Date field makes all dates before the Start Date unavailable. If you manually enter a date before the Start Date, you'll see an error message.

You may also need to specify a format for dates. See Format a Date Field for information on how to format a date field of a business object.