Toggle menu

Date Input

This field lets a user enter a date using separate inputs for day, month and year. While you can choose the format/ordering of the inputs when the field is displayed, the date is always submitted as a string in ISO-8601 format (eg 2023-04-27).

The field includes built-in validation options that let you restrict the date to the past, future, or dates before or after a set date. It also automatically prevents users from entering invalid dates (eg 31st of Feb) and caters for leap years.

You can also write a custom validation function, calculate the default value and trigger a handler when the field value changes.

Properties

LabelDescriptionType Name
LabelThe label for this fieldLABEL
Show LabelWhether to show the label for this field or not. This property adds/removes a class on the field's label element. The styling itself is controlled by the site's stylesheetSHOWLABEL
HintAdditional information displayed alongside the field to assist the user in completing it. The value of another field can be used by adding the field's name between # characters. See Common Field Properties for more informationHINT
RequiredWhether or not the field is needs to have a value to pass validation and allow the page to be submitted. Note that the field will fail validation until a complete date is enteredREQUIRED
DefaultDefault value for the field. This must be in YYYY-MM-DD formatDEFAULT
Error MessageThe error message that will be displayed if this field fails its validationERRMSG
Error Message FunctionA function that can be used to override the default error message. You can return a different message for each error type. The message can include the value of another field can be used by adding the field's name between # characters. See Error Message Functions for more information.

This field has the following error types:
 
  • REQUIRED - the field is required but has been left blank
  • MISSINGDAY - the day value is missing
  • MISSINGMONTH - the month value is missing
  • MISSINGYEAR - the year value is missing
  • FORMAT - the value doesn't match the required format
  • AFTERDATE - the date is before the required date
  • BEFOREDATE - the date is after the required date
  • RANGE - the date is outside of the preset range
  • VALIDATIONFUNCTION - the result of a custom validation function failing (validation function can also return custom error types)
ERRMSGFUNC
SearchableWhether this field's value should be indexed by the search (the object collection if using the database save action and/or workflow process collection if starting a workflow process).

This property is ignored if the form is using an an external type (the property is set in the external type itself) 
SEARCHABLE
Display FormatChoose the display order of the input boxes. Options are day-month-year, month-day-year or year-month-day. This only changes how the field appears on the form, the date is always submitted and stored as an ISO-8601 string (eg 2023-04-27)DISPLAYFORMAT
RangeRestrict the date date that can be entered to the past or the future, including or excluding todayRANGE
After DateEnter a date in YYYY-MM-DD format. The input date must be after this dateAFTERDATE
Before DateEnter a date in YYYY-MM-DD format. The input date must be before this dateBEFOREDATE
Auto-completeWhether or not the field will try to auto-complete using values stored in the user's browser. Adds the autocomplete HTML attribute to the field. See Common Field Properties for more informationAUTOCOMPLETE
Day LabelThe label that appears above the Day inputLABELDAY
Month LabelThe label that appears above the Month inputLABELMONTH
Year LabelThe label that appears above the Year inputLABELYEAR
Validation FunctionA JavaScript function that can be used to provide custom field validation whenever the field value changes or the form is submitted. This function will be executed client-side, provided JavaScript is enabled in the browser, and repeated server-side.

The value to be validated is supplied as a string in YYYY-MM-DD format
VALFUNC
Default FunctionA JavaScript function that can be used to calculate the default field value. This function is executed server-side when the field HTML is generated.

The currentValue and defaultValue are either a string in YYYY-MM-DD format ot an empty string. The returned value should also be in this format
DEFFUNC
HandlersA JavaScript function that is executed client-side whenever the page loads, or the field value changes. This function is useful for modifying the values of other fields based on an entered value.

The value is either a string in YYYY-MM-DD format ot an empty string
HANDLERS
Read OnlyDisplay the field as read onlyREADONLY
Additional Styling ModifierAn optional CSS modifier for the field. See Common Field Properties for an exampleADDITIONALSTYLINGMODIFIER
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION

Share this page

Facebook icon Twitter icon email icon

Print

print icon