Location
To create a single line input of type- location, define the type value as location. The list of attributes passed to the input fields are as given below. The mandatory parameters are indicated with a *.
Attribute Name | Data Type | Description |
type* | String Value should be location. | The type of the input field. Value of the field should be location. |
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 form field. Upon submitting a form, the value defined for the key will be available in the function associated with the form. |
label* | String (50) | Describes the display name for the field. |
hint | String (100) | Provides a brief description of the field's 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 form field is mandatory or not. The default value is 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: You cannot pick locations falling outside the specified radius. For example, "boundary": {"latitude":80.123,"longitude":20.345,"radius":10} |
Syntax
{
"hint": "",
"name": "",
"label": "",
"placeholder": "",
"type": "location",
"value": "",
"mandatory":false ,//boolean, default is set false
"boundary":
{
"latitude": ,
"longitude": ,
"radius":
}
}
Sample Code
inputs = list();
inputs.add({
"type":"location",
"name":"place",
"label":"Location",
"hint":"Please specify a valid location",
"placeholder":"Click to select location",
"boundary":{
"latitude":41.8781,
"longitude":-87.6298,
"radius":10
},
"mandatory":true
});
form={
"type":"form",
"hint":"Give location access!",
"title":"ZylCal Meetups",
"name":"ID",
"version":1,
"actions":{
"submit":{
"type":"invoke.function",
"name":"userinfo"
}
},
"inputs":inputs
};
return form;