Bonjour,
J'ai un petit souci, je charge des formulaires dans des modals en cascade. Lorsque la 2ème fenêtre s'ouvre, l'événement show.bs.modal de la 1ère fenêtre est déclenchée, je comprends pas pourquoi.
J'ai ma 1ère page avec ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<div class="modal fade" id="modalPatient" tabindex="-1" role="dialog" aria-labelledby="modalPatientLabel" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
        </div>
    </div>
</div>
 
<a class="btn btn-default glyphicon glyphicon-plus " role="button" data-toggle="modal_multi" data-target="#modalPatient" data-remote="{{ path('patient_correspondant_new') }}" data-js="refreshCorrespondants"></a>
...
$(document).on({
    'show.bs.modal': function (e) 
        var zIndex = 1040 + (10 * $('.modal:visible').length);
        $(this).css('z-index', zIndex);
        setTimeout(function() {
            $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
        }, 0);
 
    },
    'hidden.bs.modal': function() {
        if ($('.modal:visible').length > 0) {
            // restore the modal-open class to the body element, so that scrolling works
            // properly after de-stacking a modal.
            setTimeout(function() {
                $(document.body).addClass('modal-open');
            }, 0);
        }
    }
}, '.modal');
 
  //$('a[data-toggle="modal"]').on('click', function(e) {
  $(document).on('click', 'a[data-toggle="modal_multi"]', function(e) {
    var target_modal = $(e.currentTarget).data('target');
 
    $(target_modal).data('js',$(e.currentTarget).data('js'))
    // also get the remote content's URL
    var remote_content = $(e.currentTarget).data('remote');
    var modal = $(target_modal);  
    var modalContent = $(target_modal + ' .modal-content');
 
    modalContent.load( remote_content, function() {
        modal.modal();
      });
 
    return false;
  });
JE charge mon 1er formulaire qui contient une autre fenêtre à ouvrir
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
<div class="modal fade" id="modalCorrespondant" tabindex="-1" role="dialog" aria-labelledby="modalCorrespondantLabel" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
 
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
//FORM
<a class="btn btn-default glyphicon glyphicon-plus " role="button" data-toggle="modal_multi" data-target="#modalCorrespondant" data-remote="{{ path('correspondant_profession_new') }}" data-js="refreshProfession"></a>

Quand je clique sur ce 2ème bouton, cela ouvre bien ma fenêtre modalCorrespondant mais par contre cela relance l'événement show.bs.modal de ma première fenêtre modalPatient, je ne comprend pas pourquoi?

Je vous remercie