Checkbox Fields in Forms

Checkbox fields in Cliq forms allow users to select one or more options from the list of options provided. A list of attributes passed for this field are given below. All the mandatory parameters are indicated with a and the maximum characters allowed is provided with the Data Type. 

Attribute Name

Data Type

Description

type*
 

String 
Value should be checkbox 

The type of the input field. Value of the field should be checkbox.

name*

String (50)

A unique identifier for the field. Upon form submission, value defined for this key will be available in the function associated with the form.

label*

String (50)

Describes the display name for this field.

hint

String (100)

Provides a brief description of the fields purpose and the expected input.

max_selections

Int (1-5)

Specifies the maximum number of selections that the user can make.

options*

Array (1-5)

An array of JSON object following the structure label and value. Label indicates the display text for each checkbox and value represents the value associated with each checkbox option. 

Note: The maximum number of options allowed is 5. 

FORMAT

{

label: $label, (Maximum allowed characters: 100)
value: $value (Maximum allowed characters: 50)


(or)

options:[{label, value}]

}

valueString(260)Provide a default input value for the field. This should be same as the values defined in the options array. You can pass multiple values separated by commas. 

mandatory

Boolean

Defines if the field's requisite is mandatory or not. 
Note: Default value is considered to be false.

 

Syntax


{
"type":"checkbox",
"name":"",
"label":"",
"hint":"",
"max_selections":"",
"options":{
{
"label":"",
"value":""
},
{
"label":"",
"value":""
},
{
"label":"",
"value":""
},
{
"label":"",
"value":""
},
{
"label":"",
"value":""
}
}
"value":"",
"mandatory":false //Default value is false
}

Example code for a bot's message handler



inputs = list();
inputs.add({
"type":"checkbox",
"name":"projectdetails",
"label":"Component Details ",
"hint":"Select the components that you are using to build your extension. ",
"value":"commands,schedulers"
"max_selections":2,
"options":{{
"label":"Commands",
"value":"commands"},
{
"label":"Bots",
"value":"bots"
},
{"label":"Schedulers",
"value":"schedulers"
},
{"label":"Databases",
"value":"databases"
},
{"label":"Connections",
"value":"connections"
}}});
form= {
"type":"form",
"title":"ZylCal Users",
"hint":"Submit your details to early access to ZylTrix!",
"name":"ID","version":1,
"actions":{
"submit":{
"type":"invoke.function",
"name":"info"}},
"inputs":inputs
};
return form;