Skip to main content

Location 

To create an input of type- location, define the type value as location. The list of attributes passed to the input fields are as given below. 

Attribute NameDatatype Description
type*String 
(Value should be location)
The type of the input field. Value of the field should be location.
placeholder*String (150)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, 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.
valueObject

Denotes the latitude and longitude of the selected location. Specifying lat and long coordinates in the value object will display the respective location as selected. 

"value": {"latitude": "13.08891","longitude": "80.26483"}

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

Denotes the latitude and longitude of the location along with the radius. Radius denotes the specific limit within which a location can be selected. 
Note: You cannot pick locations falling outside the specified radius.
For example,
"boundary": {"latitude":"80.123","longitude":"20.345","radius":10}

Note: The radius will always be in kilometres

disabledBooleanIf disabled is true, then the field will not be editable

Sample Code:

Copied{
   "name":"location",
   "type":"location",
   "label":"Location",
   "placeholder":"Select location",
   "hint":"Delivery location",
   "mandatory":true,
   "value":{
      "latitude":"12.831292",
      "longitude":"80.0493"
   },
   "boundary":{
      "latitude":"22.8",
      "longitude":"90.8",
      "radius":"10"
   },
   "disabled" : false
}

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

Copied{
   "meta":{
      "type":"location",
      "value": "{ "latitude":"12.831292","longitude":"80.0493"}"
   },
   "value":{
      "country":"India",
      "country_code":"in",
      "city":"Gudvancherry",
      "latitude":"12.831292",
      "district":"Chengalpattu",
      "state":"Tamil nadu",
      "full_address":"Bucket Building, Grand Southern Trunk Road, Guduvancherry, Chengalpattu, Tamil Nadu, 603202, India",
      "postal_code":"603202",
      "longitude":"80.0493"
   }
}