Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:15:37+00:00 2026-06-02T19:15:37+00:00

I am trying to add google maps for my form, so after they enter

  • 0

I am trying to add google maps for my form, so after they enter the address they can view map and after that maps latitude and longitude submitted to the database. So far I couldn’t implement it. I tried it on jsfiddle and it worked. But when i try to add to the page it not working.
http://jsfiddle.net/pborreli/pJgyu/

Here is the full page.

<!DOCTYPE html>
<htmllang-"en">
<head>
<meta charset="utf-8">
<title>My First Guide</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="css/prettify.css" rel="stylesheet">
<!--<link href="css/docs.css" rel="stylesheet">-->
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<style type="text/css">
  body {
    padding-top: 60px;
    padding-bottom: 40px;
  }  
</style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
$("#address").change(function() {
      var geocoder = new google.maps.Geocoder();
        var add = $("#address").val();
        geocoder.geocode( { 'address': add}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
        var latitude = results[0].geometry.location.lat();
        var longitude = results[0].geometry.location.lng();
        var map;
        function initialize() {
            var myOptions = {
              zoom: 8,
              center: new google.maps.LatLng(latitude, longitude),
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById('map'),
                myOptions);
          }

          google.maps.event.addDomListener(window, 'load', initialize);
    }; 
    });​
</script>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<body>
  <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </a>
        <a class="brand" href="#">My First Guide</a>
        <div class="nav-collapse">
          <ul class="nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">Write a review</a></li>
            <li><a href="#contact">Talk</a></li>
            <li><a href="#contact">Events</a></li>
            <li>
                <form class="navbar-search pull-left">
                    <!--You can put class="search-query" too.-->
                    <input type="text" class=".navbar-search" placeholder="Search">
                </form>
            </li> 
          </ul>
        </div><!--/.nav-collapse -->
      </div><!-- div container -->
    </div><!-- div navbar-inner -->
  </div><!-- navbar navbar-fixed-top -->


<div class="container">
    <form class="form-horizontal">
        <fieldset>
            <legend>Submit Business Place</legend>
            <div class="control-group">
                <label class="control-label" for="input01">Business Name</label>
                <div class="controls">
                    <input type="text" class="input-xlarge" id="input01">
                    <p class="help-block">Please specify the name of business.(May
                        be it is a brand name)</p><br />
                </div>

                <div class="control-group">
                    <label class="control-label" for="input01">Address</label>
                    <div class="controls">
                        <input type="text" class="input-xlarge" id="ad">
                        <p class="help-block">To use lines please specify
                            &lsaquo;br/&rsaquo; tag.</p><br/>
                            <div id="map"></div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="textarea">Description</label>
                        <div class="controls">
                            <textarea class="input-xlarge" id="textarea" rows="10"></textarea>
                        </div>

                    </div>

                    <label class="control-label" for="input01">Categories</label>
                    <div class="controls">
                        <input type="text" class="input-xlarge" id="input01">
                        <p class="help-block">Use comma as a separator.</p><br />
                    </div>

        </fieldset>
    </form>


</div>

<script src="js/jquery.js"></script>
<script src="js/bootstrap-transition.js"></script>
<script src="js/bootstrap-alert.js"></script>
<script src="js/bootstrap-modal.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/bootstrap-scrollspy.js"></script>
<script src="js/bootstrap-tab.js"></script>
<script src="js/bootstrap-tooltip.js"></script>
<script src="js/bootstrap-popover.js"></script>
<script src="js/bootstrap-button.js"></script>
<script src="js/bootstrap-collapse.js"></script>
<script src="js/bootstrap-carousel.js"></script>
<script src="js/bootstrap-typeahead.js"></script>

</body>
</html>

But here is javascript stuff.

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">    </script>
<script type="text/javascript">
$("#address").change(function() {
  var geocoder = new google.maps.Geocoder();
    var add = $("#address").val();
    geocoder.geocode( { 'address': add}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
    var latitude = results[0].geometry.location.lat();
    var longitude = results[0].geometry.location.lng();
    var map;
    function initialize() {
        var myOptions = {
          zoom: 8,
          center: new google.maps.LatLng(latitude, longitude),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map'),
            myOptions);
      }

      google.maps.event.addDomListener(window, 'load', initialize);
}; 
});​
</script>

And here is the div where i add my map.

<div class="control-group">
                    <label class="control-label" for="input01">Address</label>
                    <div class="controls">
                        <input type="text" class="input-xlarge" id="ad">
                        <p class="help-block">To use lines please specify
                            &lsaquo;br/&rsaquo; tag.</p><br/>
                            <div id="map"></div>
                    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:15:39+00:00Added an answer on June 2, 2026 at 7:15 pm

    I’ve done a quick scan of your code and there seem to be some basic coding problems:

    1. You appear to create your map in an intialize function, but your initialize function appears to be embedded within the larger .change() callback function; I do not see how your map is ever going to be displayed.
    2. Your JavaScript code is focused on a jQuery search for an element with the id: address, but there does not appear to be an element with that id in your markup.
    3. The label you define that contains the text Address says that it is a label for: input01, but you have 2 distinct elements in your markup that have been assigned the id: input01.
    4. There are multiple labels that have been marked as being the label for: input01.
    5. All of the script tags you have defined at the bottom of your file are missing the type attribute.

    I think you have too many basic coding errors and it looks like you may have possibly garbled the code during the process of submitting it for review? It’s hard to tell, but I hope my feedback is helpful and will help you to get closer to your goal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add pin/address annotations in my Google maps view. When I do
I am trying to create a Google Maps application that has the map of
I have been trying to add a link to Google Maps so that I
I'm working on a GWT app that's using Google Maps. I'm trying to add
I'm trying to make a map that doesn't wrap horizontally, using the Google Maps
I am trying to use the Google Map API- I've successfully managed to add
I'm trying to extend jWysiwyg with an function to add a map from Google
I'm trying to add a few tweets to an infowindow in Google Maps. I
NOTE: I'm using v3 of the Google Maps API I'm trying to add an
I am trying to learn about Google maps API. I have a project that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.