Skip to content

Commit 1458e75

Browse files
committed
Write the Google RAW Data
On change the RAW data of Google can be written to an attribute
1 parent ae20dd9 commit 1458e75

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

src/GoogleAutocomplete/GoogleAutocomplete.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
<attributeType name="Decimal" />
4242
</attributeTypes>
4343
</property>
44+
<property key="attrRaw" required="false" type="attribute">
45+
<caption>Raw data</caption>
46+
<category>Data</category>
47+
<description>Attribute to place the Google RAW JSON data which should be unlimited in length</description>
48+
<attributeTypes>
49+
<attributeType name="String" />
50+
</attributeTypes>
51+
</property>
4452

4553
<property key="attrStreet" required="false" type="attribute">
4654
<caption>Street</caption>
@@ -56,6 +64,7 @@
5664
<description>Attribute for the housenumber</description>
5765
<attributeTypes>
5866
<attributeType name="String" />
67+
<attributeType name="Integer" />
5968
</attributeTypes>
6069
</property>
6170
<property key="attrPostalcode" required="false" type="attribute">
@@ -82,7 +91,7 @@
8291
<attributeType name="String" />
8392
</attributeTypes>
8493
</property>
85-
94+
8695
<property key="mfOnchange" type="microflow" required="false" defaultValue="">
8796
<caption>Onchange microflow</caption>
8897
<category>Behavior</category>

src/GoogleAutocomplete/widget/GoogleAutocomplete.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -231,33 +231,8 @@ define([
231231
this._checkAttribute({postal_code: "short_name"}, place.address_components, this._contextObj, this.attrPostalcode);
232232
this._checkAttribute({country: this.countryName}, place.address_components, this._contextObj, this.attrCountry);
233233

234-
235-
// for (var i = 0; i < place.address_components.length; i++) {
236-
// var addressType = place.address_components[i].types[0];
237-
// logger.debug(this.id + "._inputEvent check " + addressType);
238-
// if (componentForm[addressType]) {
239-
// var val = place.address_components[i][componentForm[addressType]];
240-
//
241-
// var attribute = '';
242-
// if (addressType == 'route' && this.attrStreet !== '') {
243-
// attribute = this.attrStreet;
244-
// } else if (addressType == 'locality' && this.attrCity !== '') {
245-
// attribute = this.attrCity;
246-
// } else if (addressType == 'street_number' && this.attrHouseNr !== '') {
247-
// attribute = this.attrHouseNr;
248-
// } else if (addressType == 'postal_code' && this.attrPostalcode !== '') {
249-
// attribute = this.attrPostalcode;
250-
// } else if (addressType == 'country' && this.attrCountry !== '') {
251-
// attribute = this.attrCountry;
252-
// }
253-
//
254-
// //console.log(val+'-'+addressType+'-'+attribute);
255-
// if (attribute !== '' && val !== '') {
256-
// logger.debug(this.id + "._inputEvent Set " + attribute + " - " + val);
257-
// this._contextObj.set(attribute, val);
258-
// }
259-
// }
260-
// }
234+
if(this.attrRaw)
235+
this._contextObj.set(this.attrRaw, JSON.stringify(place.address_components));
261236
}
262237
}
263238
this._UpdateData();

test/GooglePlacesTest.mpr

5 KB
Binary file not shown.
-130 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)