ReverseGeolocatorButton
This form control is a button which request the current location of the user and fills in the form fields defined in its options.
<div id="getLocation"
class="pdf-hide"
data-win-control="HFWinJSCtrl.ReverseGeolocatorButton"
data-win-options="{
buttonLabel: 'Get Location',
buttonType: 'small',
targetFields: {'address_zip_code':'postal_code', 'address_city': 'locality', 'address_street_and_no':'route + street_number' },
typesSeperator: ', ',
nextToField: 'address_city',
watcher: {
alwaysShowAccuracy: true,
acceptResultAfter: 10,
acceptPositionIfExact: true,
requestAlwaysNewPosition: true
}
}"></div>
Property | Type | How to use | Description |
---|---|---|---|
buttonLabel | String | buttonLabel: 'Get Location' | Sets the label of the button (displayed if buttonType is "medium" or "large") |
buttonType | String | buttonType: 'large' | There are three buttonTypes "small", "medium" and "large" |
doNotCopy | Boolean | doNotCopy: true | Set "true" whenever the field should get deleted if form is copied. |
nextToField | String | nextToField: 'address_city' | Define the form control the button should be placed next to. |
targetFields | Object | targetFields: {'address_zip_code':'postal_code', 'address_city': 'locality', 'address_street_and_no':'route + street_number' } | An object with key-value pairs. The key is the fieldId, the value is one of the possible components of a google maps reverse geocoding result. For more information about the different address types see the reverse geocoding documentation of Google. Concatenation of address types is possible with the plus sign. |
typesSeperator | String | typesSeperator: ', ' | Specifies a delimiter for the concatenation of address components, eg. if you want to combine the street (route) with the street number address component in one field, seperated by a comma: "Baker Street, 221b". |
watcher | Object | watcher: {...} | Define additional functions to the query and the result. |
Watcher Object
Property | Type | How to use | Description |
---|---|---|---|
alwaysShowAccuracy | Boolean | alwaysShowAccuracy: true | This property provides an information on the approximate deviation in meter and by color code ( red: deviation more than 50 m, orange: deviation between 10 and 50 m, green: deviation lower than 10 m), default setting is true . |
acceptResultAfter | Number | acceptResultAfter: 10 | Set this property to the number of seconds after which the result will be accepted automatically and stored. Note: Default settings is null (unset). |
acceptPositionIfExact | Boolean | acceptPositionIfExact: true | Set this property to accept the query result automatically if the accuracy deviation is below 10 m. |
requestAlwaysNewPosition | Boolean | requestAlwaysNewPosition: false | Set this property to false to prevent any observation of the user position changes and result updates. Default setting is true . |
Stored data
{
"id": "getLocation",
"value": {
"position": {
"latitude":47.06732,
"longitude":15.43345,
"accuracy":21,
"accuracyFormatted":"~ 21 m",
"timestamp":"2018-07-05T08:38:11.717Z"
},
"geocoderResult": {
"address_components": [
{
"long_name":"1a",
"short_name":"1a",
"types": ["street_number"]
}, {
"long_name":"Entenplatz",
"short_name":"Entenpl.",
"types": ["route"]
}, {
"long_name":"Gries",
"short_name":"Gries",
"types": ["political","sublocality", "sublocality_level_1"]
}, {
"long_name":"Graz",
"short_name":"Graz",
"types": ["locality", "political"]
}, {
"long_name":"Graz",
"short_name":"Graz",
"types": ["administrative_area_level_2","political"]
}, {
"long_name":"Steiermark",
"short_name":"Steiermark",
"types": ["administrative_area_level_1","political"]
}, {
"long_name":"Austria",
"short_name":"AT",
"types": ["country","political"]
}, {
"long_name":"8020",
"short_name":"8020",
"types": ["postal_code"]
}
],
"formatted_address":"Entenplatz 1a, 8020 Graz, Austria",
"geometry": {
"bounds": {
"south":47.0671784,
"west":15.433212700000013,
"north":47.0675852,
"east":15.433834899999965
},
"location": {
"lat":47.0674364,
"lng":15.433538099999964
},
"location_type":"ROOFTOP",
"viewport": {
"south":47.0660328197085,
"west":15.432174819708507,
"north":47.0687307802915,
"east":15.434872780291471
}
},
"place_id":"ChIJQa-mgHk1bkcR-_XOmRNkV8g",
"types":["premise"]
}
}
}