Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

location field map not working with bootstrap 4 modal #149

Closed
Esteban108 opened this issue Oct 2, 2021 · 5 comments
Closed

location field map not working with bootstrap 4 modal #149

Esteban108 opened this issue Oct 2, 2021 · 5 comments

Comments

@Esteban108
Copy link

HI all,

I am using the forms inside a bootstrap 4 modal. The Map is not render in the modal.

Example code:

<html>
    <head>
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
        {{form.media}}
    </head>
    <body>
     <div class="modal fade" id="modal1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                            {% for f in  form %}
                                <label for="{{ f.auto_id }}" class="bmd-label-static">{{ f.label }}</label>
                                {{ f }}
                            {% endfor %}
            </div></div></div>
    </body>
<script>
        $(document).ready(function (){
            $('#modal1').modal()
        })
    </script>
</html>

this code work:

<html>
    <head>
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
        {{form.media}}
    </head>
    <body>
         {% for f in  form %}
              <label for="{{ f.auto_id }}" class="bmd-label-static">{{ f.label }}</label>
              {{ f }}
         {% endfor %}
    </body>
</html>

I appreciate if you can help me solve this.

@Esteban108
Copy link
Author

I fixed it running the location map load script after of open the modal

@mgironacci
Copy link

I fixed it running the location map load script after of open the modal

Hi Esteban, can you put the code for that? I can't get it working.

@Esteban108
Copy link
Author

I fixed it running the location map load script after of open the modal

Hi Esteban, can you put the code for that? I can't get it working.

Hi, this my code

function call_modal(){
  $('#modal').modal('toggle');
  setTimeout(function () { //load map here},200)

}

In //load map here I am invoke this function because I am using django, with that module.

@mgironacci
Copy link

In //load map here I am invoke this function because I am using django, with that module.

How do you call that function? I'm trying this but get an undefined function error:
$('#map').locationField();

@Esteban108
Copy link
Author

How do you call that function? I'm trying this but get an undefined function error:

make a copy of that file and replace line 53 with:
function load_my_map () {
And line 551 for }

And use load_my_map in //load map here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants