Date and time
To create a single line input field of the type, date-time - define the value as date_time. The list of attributes passed to the input field type is given below. All the mandatory parameters are indicated with a *.
Attribute Name | Data Type | Description |
type* | String Value should be datetime | The type of input field. Value of the date-time field should be datetime |
placeholder* | String(100) | Sample field value displayed to the user that describes the expected value of the input field. |
name* | String(50) | A unique identifier for the field. Upon form submission, the value defined for the key will be available in the function associated with the form. |
label* | String(50) | Describes the display name for the field. |
hint | String(100) | Provides a brief description of the field's purpose and the expected input. |
value | Object | Describes the date, time and timezone value chosen by the user. You can also specify a default date, time and timezone value as a placeholder. 2.time_zone_id (Optional) Expected format of date_time is yyyy-MM-ddTHH:mm:ss "value": { |
mandatory | Boolean | Defines if the form field is mandatory or not. The default value is false. |
Syntax
{
"hint": "",
"name": "",
"label": "",
"placeholder": "",
"type": "datetime",
"value": "",
"mandatory":false //boolean, default is set false
}
Code sample
inputs = list();
inputs.add({
"type":"datetime",
"name":"DateTime",
"label":"Date and Time Details",
"hint":"Please cite your availability",
"placeholder":"2020-02-03T12:15",
"mandatory":"true",
"value":{
"date_time":"2020-02-03T12:15",
"time_zone_id":"Africa/Lome"
}
});
form = {
"type":"form",
"title":"ZylCal Users",
"name":"ID",
"hint":"Submit your details to get early access to ZylTrix!",
"version":1,
"button_label":"Submit",
"action":{
"type":"invoke.function",
"name":"info"
},
"inputs":inputs
};
return form;