☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

options

Table of contents

Description:

This key defines options that are specific to Date Inputs.

Appears in:
└── _inputs
    └── *
        └── Date/Datetime Input
            └── options
Type:
Object
Properties:

This key defines how an 'empty' value will be saved. Does not apply to existing empty values.

Defaults to: null

Allowed values: null string

This key defines the date and time, exclusive, that CloudCannon will allow in an Input.

When configured, CloudCannon will prevent you from selecting a later date and time.

If the Input already contains a later date and time, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes.

Value must be in ISO8601 format.

The value can have quotation marks or no quotation marks.

If options.start_from is also configured, this key cannot be an earlier date and time.

This key has no default.

This key is available for Date and Time Inputs.

Show examplesHide examples

In this example, we want our team to enter the date and time of an event in the 2022_event Input. This Input will only allow dates before January 1st, 2023.

Copied to clipboard
_inputs:
  2022_event:
    type: datetime
    options:
      start_from: 2022-01-01T00:00:00.000Z
      end_before: 2023-01-01T00:00:00.000Z
{
  "_inputs": {
    "2022_event": {
      "type": "datetime",
      "options": {
        "start_from": "2022-01-01T00:00:00.000Z",
        "end_before": "2023-01-01T00:00:00.000Z"
      }
    }
  }
}

This key defines a custom error message that explains why a value has failed the validation criteria from options.end_before. This key requires you to define options.end_before.

This key has no default.

This key is available for Date and Time Inputs.

Show examplesHide examples

In this example, we prompt our team to enter a valid date using a custom message.

Copied to clipboard
_inputs:
  2022_event:
    type: datetime
    options:
      start_from: 2022-01-01T00:00:00.000Z
      start_from_message: Date is too early. Must be during 2022.
      end_before: 2023-01-01T00:00:00.000Z
      end_before_message: Date is too late. Must be during 2022.
{
  "_inputs": {
    "2022_event": {
      "type": "datetime",
      "options": {
        "start_from": "2022-01-01T00:00:00.000Z",
        "start_from_message": "Date is too early. Must be during 2022.",
        "end_before": "2023-01-01T00:00:00.000Z",
        "end_before_message": "Date is too late. Must be during 2022."
      }
    }
  }
}
requiredboolean#

This key toggles whether CloudCannon requires this Input to have a value.

Setting this key to true will require you to enter a value to save your changes, or discard your unsaved changes.

By default, this key is false (i.e., CloudCannon does not require this Input to have a value).

This key is available for Array, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.

Defaults to: false

Show examplesHide examples

In this example, we want to require our team to enter an author value for markup files with this Input.

Copied to clipboard
_inputs:
  author:
    type: text
    comment: Enter the name of the author for this blog post.
    options:
      required: true
{
  "_inputs": {
    "author": {
      "type": "text",
      "comment": "Enter the name of the author for this blog post.",
      "options": {
        "required": true
      }
    }
  }
}

This key defines a custom error message that explains why a value has failed the validation criteria from options.required.

This key requires you to define options.required.

This key has no default.

This key is available for Array, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.

Show examplesHide examples

In this example, we prompt our team to use enter an Input value using a required message.

Copied to clipboard
_inputs:
  author:
    type: text
    comment: Enter the name of the author for this blog post.
    options:
      required: true
      required_message: You are not allowed to leave this blank.
{
  "_inputs": {
    "author": {
      "type": "text",
      "comment": "Enter the name of the author for this blog post.",
      "options": {
        "required": true,
        "required_message": "You are not allowed to leave this blank."
      }
    }
  }
}

This key defines the earliest date and time, inclusive, that CloudCannon will allow in an Input.

When configured, CloudCannon will prevent you from selecting an earlier date and time.

If the Input already contains an earlier date and time, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes.

Value must be in ISO8601 format.

The value can have quotation marks or no quotation marks.

If options.end_before is also configured, this key cannot be a later date and time.

This key has no default.

This key is available for Date and Time Inputs.

Show examplesHide examples

In this example, we want our team to enter the date and time of an event in the 2022_event Input. This Input will only allow dates on or after January 1st, 2022.

Copied to clipboard
_inputs:
  2022_event:
    type: datetime
    options:
      start_from: 2022-01-01T00:00:00.000Z
      end_before: 2023-01-01T00:00:00.000Z
{
  "_inputs": {
    "2022_event": {
      "type": "datetime",
      "options": {
        "start_from": "2022-01-01T00:00:00.000Z",
        "end_before": "2023-01-01T00:00:00.000Z"
      }
    }
  }
}

This key defines a custom error message that explains why a value has failed the validation criteria from options.start_from. This key requires you to define options.start_from.

This key has no default.

This key is available for Date and Time Inputs.

Show examplesHide examples

In this example, we prompt our team to enter a valid date using a custom message.

Copied to clipboard
_inputs:
  2022_event:
    type: datetime
    options:
      start_from: 2022-01-01T00:00:00.000Z
      start_from_message: Date is too early. Must be during 2022.
      end_before: 2023-01-01T00:00:00.000Z
      end_before_message: Date is too late. Must be during 2022.
{
  "_inputs": {
    "2022_event": {
      "type": "datetime",
      "options": {
        "start_from": "2022-01-01T00:00:00.000Z",
        "start_from_message": "Date is too early. Must be during 2022.",
        "end_before": "2023-01-01T00:00:00.000Z",
        "end_before_message": "Date is too late. Must be during 2022."
      }
    }
  }
}
timezonestring#

This key defines the timezone for your Site.

Value must be in IANA timezone format.

For more information, please read our documentation on Date and Time inputs.

Allowed values: Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Asmera Africa/Bamako Africa/Bangui Africa/Banjul Africa/Bissau and 585 more.

Examples:
Open in a new tab