Skip to content

Commit 2158bac

Browse files
committed
Added callbackFormVals callback so form values can be utilized
1 parent 3df1c34 commit 2158bac

File tree

6 files changed

+50
-21
lines changed

6 files changed

+50
-21
lines changed

callbacks.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ $('#bh-sl-map-container').storeLocator({
3131
|---|---|
3232
| [callbackNotify](callbacks/callback-notification.md) | Notification callback |
3333
| [callbackRegion](callbacks/callback-region.md) | Region callback |
34+
| [callbackRegion](callbacks/callback-formvals.md) | Form Values callback |
3435
| [callbackBeforeSend](callbacks/callback-beforesend.md) | Before location data request callback |
3536
| [callbackDirectionsRequest](callbacks/callback-directionsrequest.md) | Directions request callback |
3637
| [callbackCloseDirections](callbacks/callback-closedirections.md) | Close directions callback |
@@ -45,4 +46,4 @@ $('#bh-sl-map-container').storeLocator({
4546
| [callbackMarkerClick](callbacks/callback-markerclick.md) | Marker click callback |
4647
| [callbackListClick](callbacks/callback-listclick.md) | Location list click callback |
4748
| [callbackPageChange](callbacks/callback-pagechange.md) | Page change callback |
48-
| [callbackFilters](callbacks/callback-filters.md) | Filters callback |
49+
| [callbackFilters](callbacks/callback-filters.md) | Filters callback |

callbacks/callback-formvals.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# callbackFormVals
2+
3+
## Description
4+
5+
Fires after the form values have been processed from the form. If you are planning on sending these values to a database
6+
make sure to sanitize the values first.
7+
8+
## Parameters
9+
10+
| Name | Type | Description |
11+
|---|---|---|
12+
| addressInput | string | User address input |
13+
| searchInput | string | User name search input when using nameSearch setting |
14+
| distance | string | User distance selection when using maxDistance setting |
15+
| region | string | User region selection when using regionID setting or callbackRegion callback |

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.7.5 - 2017-11-05
1+
/*! jQuery Google Maps Store Locator - v2.7.5 - 2017-11-28
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2017 Bjorn Holine; Licensed MIT */
44

@@ -26,8 +26,8 @@
2626
'addressID' : 'bh-sl-address',
2727
'regionID' : 'bh-sl-region',
2828
'mapSettings' : {
29-
mapTypeId : google.maps.MapTypeId.ROADMAP,
30-
zoom : 12
29+
mapTypeId: google.maps.MapTypeId.ROADMAP,
30+
zoom : 12
3131
},
3232
'markerImg' : null,
3333
'markerDim' : null,
@@ -97,6 +97,7 @@
9797
// Callbacks
9898
'callbackNotify' : null,
9999
'callbackRegion' : null,
100+
'callbackFormVals' : null,
100101
'callbackBeforeSend' : null,
101102
'callbackSuccess' : null,
102103
'callbackModalOpen' : null,
@@ -650,22 +651,22 @@
650651
this.mapping(null);
651652
}
652653
}
654+
}
653655

654-
// HTML5 auto geolocation API option
655-
if (this.settings.autoGeocode === true && doAutoGeo === true) {
656-
_this.writeDebug('Auto Geo');
656+
// HTML5 auto geolocation API option
657+
if (this.settings.autoGeocode === true && doAutoGeo === true) {
658+
_this.writeDebug('Auto Geo');
657659

658-
_this.htmlGeocode();
659-
}
660+
_this.htmlGeocode();
661+
}
660662

661-
// HTML5 geolocation API button option
662-
if (this.settings.autoGeocode !== null) {
663-
_this.writeDebug('Button Geo');
663+
// HTML5 geolocation API button option
664+
if (this.settings.autoGeocode !== null) {
665+
_this.writeDebug('Button Geo');
664666

665-
$(document).on('click.'+pluginName, '#' + this.settings.geocodeID, function () {
666-
_this.htmlGeocode();
667-
});
668-
}
667+
$(document).on('click.'+pluginName, '#' + this.settings.geocodeID, function () {
668+
_this.htmlGeocode();
669+
});
669670
}
670671
},
671672

@@ -1573,6 +1574,11 @@
15731574
region = $('#' + this.settings.regionID).val();
15741575
}
15751576

1577+
// Form values callback
1578+
if (this.settings.callbackFormVals) {
1579+
this.settings.callbackFormVals.call(this, addressInput, searchInput, distance, region);
1580+
}
1581+
15761582
if (addressInput === '' && searchInput === '') {
15771583
this._start();
15781584
}

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ filtering.
3737

3838
### Version 2.7.5
3939

40+
* Added callbackFormVals callback so form values can be utilized.
4041
* Fixed issue where HTML5 Geolocation was skipped when using the fullMapStartBlank setting.
4142

4243
### Version 2.7.4

src/js/jquery.storelocator.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
'addressID' : 'bh-sl-address',
2424
'regionID' : 'bh-sl-region',
2525
'mapSettings' : {
26-
mapTypeId : google.maps.MapTypeId.ROADMAP,
27-
zoom : 12
26+
mapTypeId: google.maps.MapTypeId.ROADMAP,
27+
zoom : 12
2828
},
2929
'markerImg' : null,
3030
'markerDim' : null,
@@ -94,6 +94,7 @@
9494
// Callbacks
9595
'callbackNotify' : null,
9696
'callbackRegion' : null,
97+
'callbackFormVals' : null,
9798
'callbackBeforeSend' : null,
9899
'callbackSuccess' : null,
99100
'callbackModalOpen' : null,
@@ -1570,6 +1571,11 @@
15701571
region = $('#' + this.settings.regionID).val();
15711572
}
15721573

1574+
// Form values callback
1575+
if (this.settings.callbackFormVals) {
1576+
this.settings.callbackFormVals.call(this, addressInput, searchInput, distance, region);
1577+
}
1578+
15731579
if (addressInput === '' && searchInput === '') {
15741580
this._start();
15751581
}

0 commit comments

Comments
 (0)