Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps, Geocoding and more [closed]

First at all, project is written in PHP with jQuery enabled.

The situation description might be like so: User can define his address. When user wants to add location of something (no matter what), user can choose, weather to use his defined address or choose new one. If he chooses new one, he can type it input as text.

Since I have to use Google Maps, it gets terrible hard to get it work. I want to display his defined address at first point, before choosing (defined/new) address (done, works great). If user leaves defined address, then no problems, Google maps stays as loaded. If user adds other address, I want to zoom out the map (done, works great), and after he finishes typing new address, then Google maps shows this newly typed one (nothing shows up).

Please, check my code below, so this text above would make a bit more sense...

And if you could help, please, do so :)

This is my HTML part:

<span><input type="checkbox" name="other_address" value="1"> I want to change address</span>
<input type="text" name="input_location" value="Bismarckallee 3, Freiburg" id="input_location" placeholder="Adress (Street, City)">
<input type="hidden" name="input_coordinates" value="47.997337,7.841653">
<div id="map_canvas" class="user_location_map" style="width: 100%; height: 300px;"></div>

This is my Javascript part (as its 73 lines, I used pastebin, not pasted in here):

http://pastebin.com/VyAHe90j

Thanks!

like image 329
Rozkalns Avatar asked Nov 16 '25 17:11

Rozkalns


1 Answers

Try this -- you were missing a listener to update the map when you entered a new address:

http://pastebin.com/yraxkDmP

like image 101
richardm Avatar answered Nov 19 '25 06:11

richardm