Single-line Input Fields

Cliq form fields have been broadly classified based on the different types of inputs from a user. Any field that requires user input with text, broadly categorized into 

Single-line Input Fields

These fields again are classified based on the input values, into: 

Quick Tip:

All input field types given here are explained with a sample code snippet. Try out these snippets by creating a slash command.

Single-line Input Type: Text

The single line text input field is the most basic input field type and can be either plain text or formatted. The format of the single line text field can be defined using the format key in the JSON. It can be used to collect information such as name, telephone, email address, URL and password, for example. The list of attributes passed for this input field are given below. All mandatory attributes are indicated with a * and the character limit for each attribute is also provided.

Attribute NameData TypeDescription
type* textThe type of input field. For single line text input, type must be text
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. On form submission, the value defined for this key will be available in the function associated with the form.
label*string (50)Describes the field display name.
hintstring (100)Provides a brief description of the field's purpose and the expected input.
max_lengthinteger (100)Specifies the maximum number of characters allowed as input.
min_lengthintegerSpecifies the minimum number of characters allowed as input.
valuestring(100)Provide a default input value for the field.
mandatorybooleanDefine if the field's requisite is mandatory or not.
Default value considered is true.

Syntax


{
  "type": "text",
  "name": "",
  "label": "",
  "hint": "",
  "placeholder": "",
  "mandatory":true , //boolean, default is true
  "value": "",
  "max_length": "",
  "min_length": ""
  }

Code Sample

Single Line Input Type: Text 



inputs = list();
inputs.add(
{
  "type": "text",
  "name": "username",
  "label": "User Name",
  "hint": "Please enter your Zylcal Username",
  "placeholder": "ScottFisher",
  "mandatory": true,
  "value": "ScottFisher",
  "max_length": "10",
  "min_length":"6"
});
form = {
  "type": "form",
  "title": "ZylCal Users",
  "hint": "Submit your details to get early access to ZylTrix!",
  "name": "ID",
  "version": 1,
  "button_label": "Submit",
  "action": {
      "type": "invoke.function",
      "name": "userinfo"
  },
  "inputs": inputs
};
return form;

Single-line input text - with format

The format of the single line text field can be defined using the format key in the JSON. It can be used to collect information such as telephone, email address, URL and password. Currently supported format fields are:

​​