Datetime Formfield

A date and time picker field for collecting temporal values with various precision levels (date, datetime, time, month, year).

Properties

Attribute Comments
basic
name
string / required / unique

Field name
Alfanumeric + underscore + dash

This attribute represents the name of the form field.

type
string / required

Field type

Other attributes might only be available for some field types.

Choices:
  • text
  • textarea
  • datetime
  • html
  • file
  • number
  • password
  • checkbox
  • radio
  • enum
  • expression
  • table
dateType
string
added in version 4.0.2

DateType of the datetime picker

The datetime picker can pick several types

Choices:
  • date
  • datetime
  • time
  • month
  • year
convertToUtc
boolean
added in version 6.1.4

Convert datetime to UTC

When enabled, the selected date/time will be converted to UTC timezone before being sent to Ansible. When disabled, the date/time will be used as entered without timezone conversion (local time as ISO string without timezone info).

Important: Only works when dateType is set to datetime. Has no effect for other dateTypes (date, year, month, week, time).

Use case: If a user in GMT+2 timezone picks 14:00 with convertToUtc enabled, the field will show 14:00 but the output will be 12:00 UTC (timezone-aware conversion). Without conversion, the output would be 14:00 (server’s local time).

Default:
false
label
string

Field label
Free text

A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html.

Since 6.0.3: Supports placeholders for dynamic labels (e.g., Label: $(fieldname)).

placeholder
string

In-field help value
Free text

Some form fields allow an in-field hint value.

Since 6.0.3: Supports placeholders for dynamic hints (e.g., Enter password (min $(minLength) chars)).

help
string

Field help message
Free text

Some fields require additional help information. This help message will be shown below the field.

Since 6.0.3: Supports placeholders for dynamic help text (e.g., This field depends on $(fieldname)).

data
default
many

Default value

The type of the value depends on the field type.
Can be string,boolean, number, array or object. When using multiple, the default must be an array.
When using an enum field, you can use the following special values :

  • __auto__ : select the first
  • __none__ : select none
  • __all__ : select all (if multiple is true)

evalDefault
boolean
added in version 4.0.5

Evaluates default value

A default can be treated as javascript and can thus hold expressions like '$(other_field)'.toUpperCase() or Math.PI or Date.getDate.toISOString()

Default:
false
interaction
dependencyFn
string
added in version 4.0.0

The dependency logical function

This attribute represents the logical function between multiple dependencies.

Choices:
  • and (default)
  • or
dependencies
list / elements=object

Show/hide this field based on the values or other fields
Reference to other formfields and their values

Each dependency element is either an object with the following 2 attributes:

  • name : holds the fieldname.
  • values : a list of valid values for the referenced field.

Or with the following 2 attributes:

  • name : holds the fieldname.
  • isValid : a boolean to check if the referenced is validated or not.

Use in combination with attribute dependencyFn.

output
noOutput
boolean

Do not output as extravar

Form fields are by default send as extravars.
If you do not want a field to be sent as extravar, set this attribute to true.

Default:
false
model
string or array

Extravar modelling
An dot-based string notation of an object, or an array of these

By default, a field is sent as a root-extravar.
If you want model the output of the extravars, you can specify a dot-notation of how this field should be modelled.

security
noLog
boolean
added in version 2.2.3

Disable backend logging

Disables logging in the backend, to hide passwords for example.

Default:
false
validation
required
boolean

Required field

Makes the field required.

Default:
false
regex
object

A regular expression validation

Enforces a validation where the current field must match a regular expression. This field requires an object with 2 attributes:

  • expression : The regular expression
  • description : A validation message to show when the regex is not matched. (Since 6.0.3: Supports placeholders for dynamic messages)

notIn
object
added in version 2.2.4

A list validation (can not be in list)

Enforces a validation where the current field can not be one of the values in a list (referencing another field). This field requires an object with 2 attributes:

  • field : The name of the field that holds the list
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

in
object
added in version 2.2.4

A list validation (must be in list)

Enforces a validation where the current field must be one of the values in a list (referencing another field). This field requires an object with 2 attributes:

  • field : The name of the field that holds the list
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

validIf
object
added in version 2.2.4

An field based validation (field must be true)

Enforces a validation where a referencing (expression) field must be true. This field requires an object with 2 attributes:

  • field : The name of the referencing field
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

validIfNot
object
added in version 2.2.4

An field based validation (field must be false)

Enforces a validation where a referencing (expression) field must be false. This field requires an object with 2 attributes:

  • field : The name of the referencing field
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

ignoreIncomplete
boolean

Allow form submit on non-evaluated placeholders

When an expression-based field has placeholders,
the default form behaviour is not to allow form submit until all placeholders are resolved. When this attribute is true, the form does not wait for placeholder completion for this field.

Default:
false
visualization
group
string

The field group name
Free text

With this attribute you can group fields together.
When all fields in a group are hidden (due to dependencies), the group is also hidden.

line
string
added in version 4.0.3

The field line name
Free text

With this attribute you can group fields in a single line together.
Use together with the width parameter to set the width, if not, the width is auto.

width
string
added in version 4.0.3

The field width
A valid Bootstrap Column width

With this attribute you can set the width of a field.
Use together wit the line parameter to put fields on 1 line. see https://getbootstrap.com/

Choices:
  • col-1
  • col-2
  • col-3
  • col-4
  • col-5
  • col-6
  • col-7
  • col-8
  • col-9
  • col-10
  • col-11
  • col-12
name
string / required / unique

Field name
Alfanumeric + underscore + dash

This attribute represents the name of the form field.

type
string / required

Field type

Other attributes might only be available for some field types.

Choices:
  • text
  • textarea
  • datetime
  • html
  • file
  • number
  • password
  • checkbox
  • radio
  • enum
  • expression
  • table
dateType
string
added in version 4.0.2

DateType of the datetime picker

The datetime picker can pick several types

Choices:
  • date
  • datetime
  • time
  • month
  • year
convertToUtc
boolean
added in version 6.1.4

Convert datetime to UTC

When enabled, the selected date/time will be converted to UTC timezone before being sent to Ansible. When disabled, the date/time will be used as entered without timezone conversion (local time as ISO string without timezone info).

Important: Only works when dateType is set to datetime. Has no effect for other dateTypes (date, year, month, week, time).

Use case: If a user in GMT+2 timezone picks 14:00 with convertToUtc enabled, the field will show 14:00 but the output will be 12:00 UTC (timezone-aware conversion). Without conversion, the output would be 14:00 (server’s local time).

Default:
false
label
string

Field label
Free text

A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html.

Since 6.0.3: Supports placeholders for dynamic labels (e.g., Label: $(fieldname)).

placeholder
string

In-field help value
Free text

Some form fields allow an in-field hint value.

Since 6.0.3: Supports placeholders for dynamic hints (e.g., Enter password (min $(minLength) chars)).

help
string

Field help message
Free text

Some fields require additional help information. This help message will be shown below the field.

Since 6.0.3: Supports placeholders for dynamic help text (e.g., This field depends on $(fieldname)).

group
string

The field group name
Free text

With this attribute you can group fields together.
When all fields in a group are hidden (due to dependencies), the group is also hidden.

line
string
added in version 4.0.3

The field line name
Free text

With this attribute you can group fields in a single line together.
Use together with the width parameter to set the width, if not, the width is auto.

width
string
added in version 4.0.3

The field width
A valid Bootstrap Column width

With this attribute you can set the width of a field.
Use together wit the line parameter to put fields on 1 line. see https://getbootstrap.com/

Choices:
  • col-1
  • col-2
  • col-3
  • col-4
  • col-5
  • col-6
  • col-7
  • col-8
  • col-9
  • col-10
  • col-11
  • col-12
dependencyFn
string
added in version 4.0.0

The dependency logical function

This attribute represents the logical function between multiple dependencies.

Choices:
  • and (default)
  • or
dependencies
list / elements=object

Show/hide this field based on the values or other fields
Reference to other formfields and their values

Each dependency element is either an object with the following 2 attributes:

  • name : holds the fieldname.
  • values : a list of valid values for the referenced field.

Or with the following 2 attributes:

  • name : holds the fieldname.
  • isValid : a boolean to check if the referenced is validated or not.

Use in combination with attribute dependencyFn.

noLog
boolean
added in version 2.2.3

Disable backend logging

Disables logging in the backend, to hide passwords for example.

Default:
false
default
many

Default value

The type of the value depends on the field type.
Can be string,boolean, number, array or object. When using multiple, the default must be an array.
When using an enum field, you can use the following special values :

  • __auto__ : select the first
  • __none__ : select none
  • __all__ : select all (if multiple is true)

evalDefault
boolean
added in version 4.0.5

Evaluates default value

A default can be treated as javascript and can thus hold expressions like '$(other_field)'.toUpperCase() or Math.PI or Date.getDate.toISOString()

Default:
false
required
boolean

Required field

Makes the field required.

Default:
false
regex
object

A regular expression validation

Enforces a validation where the current field must match a regular expression. This field requires an object with 2 attributes:

  • expression : The regular expression
  • description : A validation message to show when the regex is not matched. (Since 6.0.3: Supports placeholders for dynamic messages)

notIn
object
added in version 2.2.4

A list validation (can not be in list)

Enforces a validation where the current field can not be one of the values in a list (referencing another field). This field requires an object with 2 attributes:

  • field : The name of the field that holds the list
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

in
object
added in version 2.2.4

A list validation (must be in list)

Enforces a validation where the current field must be one of the values in a list (referencing another field). This field requires an object with 2 attributes:

  • field : The name of the field that holds the list
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

validIf
object
added in version 2.2.4

An field based validation (field must be true)

Enforces a validation where a referencing (expression) field must be true. This field requires an object with 2 attributes:

  • field : The name of the referencing field
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

validIfNot
object
added in version 2.2.4

An field based validation (field must be false)

Enforces a validation where a referencing (expression) field must be false. This field requires an object with 2 attributes:

  • field : The name of the referencing field
  • description : A validation message to show when the validation is not met. (Since 5.0.1: Supports placeholders for dynamic messages)

ignoreIncomplete
boolean

Allow form submit on non-evaluated placeholders

When an expression-based field has placeholders,
the default form behaviour is not to allow form submit until all placeholders are resolved. When this attribute is true, the form does not wait for placeholder completion for this field.

Default:
false
noOutput
boolean

Do not output as extravar

Form fields are by default send as extravars.
If you do not want a field to be sent as extravar, set this attribute to true.

Default:
false
model
string or array

Extravar modelling
An dot-based string notation of an object, or an array of these

By default, a field is sent as a root-extravar.
If you want model the output of the extravars, you can specify a dot-notation of how this field should be modelled.

Examples

DateTime

- type: datetime
  dateType: date
  name: mydate
  label: Date
  default: "2023-12-01"
  required: true
  help: A help message 
- type: datetime
  dateType: datetime
  name: mydateandtime
  line: Demo1
  label: I will default to now
  evalDefault: true
  default: "new Date().toISOString().substring(0,19).replace('T',' ')"
  required: true                      
- type: datetime
  dateType: datetime
  name: mydateandtime
  label: DateTime
  default: "2023-12-01 13:01:00"
  required: true
  help: A help message       
- type: datetime
  dateType: time
  name: mytime
  label: Time
  default: "13:01:00"
  required: true
  help: A help message     


Copyright © 2023-2026 AnsibleForms. All rights reserved.