Single-line Input Type: File Upload

The file upload field in Cliq forms allows you to attach upto a maximum of 10 files. Take a look at the list of attributes passed for this input field type is given below. All mandatory attributes are indicated with a * and the maximum characters allowed is provided with the Data Type. 

Attribute NameData TypeDescription
type*string
Value should be file
The type of single line text input field. 
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.
hint*string (100)Provides a brief description of the field's purpose and the expected input.
mandatorybooleanDefine if the field's requisite is mandatory or not.
Default value considered is true.
multiplebooleanDefine if your field should be a single select or multi select field. For all multi select fields, multiple should be set as true. 
max_selectionsinteger
Maximum selections allowed: 10

Defines the number of options that a user can choose from the drop-down. 

Note: Value for this field defaults to 1 in case of single select drop-downs.

max_size

integer

Value should be in KB ranging from 1-51200.

Defines the maximum file size limit for files to be uploaded

Syntax



{
  "hint": "",
  "name": "",
  "label": "",
  "placeholder": "",
  "type": "file",
  "mandatory": true, //boolean, default value is set as true
  "multiple": true, //boolean, default value is set as true
  "max_selections": ""
}

Code Sample


inputs = list();
inputs.add({
  "hint": "Upload your file",
  "name": "filefield",
  "label": "Upload File",
  "placeholder": "demo-file.png",
  "type": "file",
  "mandatory": true
  });
form = {
  "type": "form",
  "title": "ZylCal Users",
  "hint": "Submit your details to early access to ZylTrix!",
  "name": "ID",
  "version": 1,
  "button_label": "Submit",
  "action": {
      "type": "invoke.function",
      "name": "userinfo"
  },
  "inputs": inputs
};
return form;