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 Name | Datatype | 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. |
hint | String (100) | Provides a brief description of the fields purpose and the expected input. |
value | Object | 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"} |
mandatory | Boolean | Defines if the field's requisite is mandatory or not. Note: Default value is considered to be false. |
boundary | Object | 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: The radius will always be in kilometres |
disabled | Boolean | If disabled is true, then the field will not be editable |
Sample Code:
Copied{
"name":"location"
"type":"location",
"label":"Location",
"placeholder":"Select location",
"hint":"Please specify a valid location",
"mandatory":true,
"value":{
"latitude":"20.3",
"longitude":"80.23"
},
"boundary":{
"latitude":"34.5",
"longitude":"56.8",
"radius":"10"
},
"disabled" : true
}
JSON format passed in handlers for the filled-in value:
Copied{
"meta":{
"type":"location",
"value": "{ "latitude":"20.3","longitude":"80.23"}"
},
"value":{
"country":"USA",
"country_code":"us",
"city":"Miami",
"latitude":"11.12517",
"district":"Rockledge",
"state":"Florida",
"full_address":"Rockledge, Miami, Florida, 33101, USA",
"postal_code":"33101",
"longitude":"78.65243"
}
}