Skip to main content

Radio buttons

Radio buttons in forms allow the users to choose one item from the list of all possible options. Given below is a table containing the attributes for the input field. 

Attribute NameDatatype Description
type*String 
(Value should be radio)
The type of the input field. Value of the field should be radio.
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 (150)Describes the display name for this field.
hintString (100)Provides a brief description of the fields purpose and the expected input.
options*Array

An array of JSON object following the structure label and value. 

Note: The maximum number of options allowed is 100

FORMAT

{
label: $label, (Maximum allowed characters: 100)
value: $value (Maximum allowed characters: 100)
}

valueString(100)Provide a default input for the field by giving the value of any drop-down list item.
mandatoryBooleanDefines if the field's requisite is mandatory or not. 
Note: Default value is considered to be false.
disabledBooleanIf disabled is true, then the field will not be editable
trigger_on_changeBooleanIf this is enabled for a field or an input, then the change handler will be invoked when the value of that field is changed

Sample Code:

Copied{
   "type":"radio",
   "name":"radio",
   "label":"Subscribe to our newsletter",
   "hint":"Get to know exciting offers & discouts",
   "mandatory":false,
   "trigger_on_change":true,
   "value":"yes",
   "options":[
      {
         "label":"Yes",
         "value":"yes"
      },
      {
         "label":"No",
         "value":"no"
      }
   ],
   "disabled" : false
}

JSON format passed in handlers for the filled-in value:

Copied{
   "meta":{
      "type":"radio",
      "value":"no"
   },
   "value":{
       "label":"No",
         "value":"no"
   }
}