Comments (8)
That should be no problem!
EG:
$("#geocomplete").geocomplete("find", "Juliusstraße 25, Hamburg");
from geocomplete.
That's not what I mean.
For example, I search for the O2 Arena in Berlin and I want to populate the address field with street and number.
from geocomplete.
If Google has information about that place, it will return street number.
Try http://ubilabs.github.com/geocomplete/examples/form.html with "Fernsehturm Berlin".
from geocomplete.
And how can I combine the route and street_number in one input field as a value?
from geocomplete.
This is not possible for now.
Feel free to tweak the code around Line 196:
https://github.com/ubilabs/geocomplete/blob/master/jquery.geocomplete.js#L196
from geocomplete.
It may be late.... but use the events
$("#geocomplete")
.geocomplete()
.bind("geocode:result", function(event, result){
var stno = result.address_components[0]['long_name'];
var stna = result.address_components[1]['long_name'];
$('#street').val(stno + ' ' + stna);
});
from geocomplete.
or even
$('#street').val(result.name);
from geocomplete.
Change that.... if the field is pre-populated - you will not get "result.name"
and "result.address_components[0]" could be street number but it could be subpremise which means you need to check types array too.
try this way instead
$("#geocomplete")
.geocomplete()
.bind("geocode:result", function(event, result){
var addressArray = result.address_components;
var street = "";
for (var j = 0; j < addressArray.length; j++){
var typeName = addressArray[j].types[0];
if (typeName == 'subpremise') {
street += addressArray[j].long_name + '/';
}
if (typeName == 'street_number') {
street += addressArray[j].long_name + ' ';
}
if (typeName == 'route') {
street += addressArray[j].long_name;
}
}
$('#street').val(street);
});
from geocomplete.
Related Issues (20)
- Package Doesn't autocomplete all places that google.com/maps does! HOT 1
- Add place_changed function with the geocomplete plugin
- Script block missing HOT 1
- Does not working HOT 1
- Not responding if open a html with this plugin on iPhone UIWebView
- More than a single default location
- Blocking request until query length minimum is reached
- Adding custom search results to Autocomplete results
- Uncaught TypeError: this.$input.on is not a function
- Country Restriction HOT 1
- Map not display! HOT 1
- City not loaded HOT 2
- Select First result from listing after press tab
- Add postal_town HOT 1
- Get short version of State
- Problem of operation in some locations. HOT 1
- initialize map in lat lng HOT 2
- why newer places does not pop on recommendations
- Don't get all location
- the map not showing in div. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geocomplete.