Bootstrap model - usuwa drugiego form'a

Witam!

Mam taki problem. Zrobiłem sobie dwa pokazujące się okienta “model” które zawierają formularze. Jak miałem jeden model, wszystko śmigało. Jak dodałem drugi, z tego drugiego usuwa mi form’a i kliknięcie przycisku powoduje akcje do pliku z pierwszego forma.

Okienka otwierają się odpowiednie dla odpowiednich linków i wszystko działa jak powinno prócz usunięcia tego drogiego <form>.

 

Pomoże ktoś?

 

Poniżej kod:

<div class="modal fade" id="addLesson" tabindex="-1" role="dialog" aria-labelledby="addLessonLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="addLessonLabel">Nowa lekcja</h4>
            </div>
            <div class="modal-body">
                <form name="inputform" method="POST" action="{{ url('Lesson/editLesson', {'action': 'add'}) }}">
                    
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Godzina:</label>
                        <select name="hour" id="lesson-hour-input" class="form-control">
                            {% for i in range(1, 8) %}
                                <option value="{{ i }}">{{ i }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Nauczyciel:</label>
                        <select name="teacher" class="form-control">
                            {% for t in teachers %}
                                <option value="{{ t.id }}" {% if t.id == Me.getModel.id %} selected {% endif %}>{{ t.familyName }} {{ t.givenName }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Klasa:</label>
                        <select name="class" class="form-control" id="lesson-class-input">
                            {% for c in classes %}
                                <option value="{{ c.id }}">{{ c.name }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Przedmiot:</label>
                        <select name="subject" class="form-control" id="lesson-subject-input">
                            {% for s in subjects %}
                                <option value="{{ s.id }}">{{ s.subject }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Temat:</label>
                        <input type="text" name="topic" value="{{ lesson.topic }}" class="form-control" />
                    </div>



                    <div class="box-footer clearfix no-border">
                        <input type="submit" name="save" value="Zapisz" class="btn btn-default pull-right" />

                    </div>
            </div>
        </div>
    </div>
</div>



<script type="text/javascript" >

    $('#addLesson').on('show.bs.modal', function (event) {
        var lbutton = $(event.relatedTarget); // Button that triggered the modal
        var lrecipient = lbutton.data('lesson'); // Extract info from data-* attributes
        var lmodal = $(this);
        var lres = lrecipient.split('|');
        lmodal.find('#lesson-class-input').val(lres[1]);
        lmodal.find('#lesson-hour-input').val(lres[0]);
        lmodal.find('#lesson-subject-input').val(lres[2]);
    });

</script>




<div class="modal fade" id="addPlan" tabindex="-1" role="dialog" aria-labelledby="addPlanLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="addPlanLabel">Nowa lekcja</h4>
            </div>
            <div class="modal-body">
                <form method="POST" id="ajaxform" action="{{ url('School/plans', {'action': 'add'}) }}">
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Przedmiot:</label>
                        <select name="subject" class="form-control">
                            {% for s in subjects %}
                                <option value="{{ s.id }}">{{ s.subject }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Nauczyciel:</label>
                        <select name="teacher" class="form-control">
                            {% for t in teachers %}
                                <option value="{{ t.id }}">{{ t.givenName }} {{ t.familyName }}</option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Grupa:</label>
                        <select name="group" class="form-control">
                            <option value="0">-brak-</option>
                            {% for gr in groups %}
                                <option value="{{ gr.id }}">
                                    {% if gr.level > 0 %}
                                        {% for i in range(1, gr.level) %}&nbsp;&nbsp;&nbsp;{% endfor %}
                                    {% endif %}
                                    {{ gr.name }}
                                </option>
                            {% endfor %}
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Sala:</label>
                        <select name="classroom" class="form-control">
                            {% for c in classrooms %}
                                <option value="0">-brak-</option>
                                <option value="{{ c.id }}">{{ c.name }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">Obowiązuje od - do:</label>
                        <div class="input-group">
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                            <input type="text" name="dateRange" class="form-control pull-right" id="daterange" value="" />
                        </div>
                    </div>

                    <input type="hidden" name="class" id="class-input" />
                    <input type="hidden" name="hour" id="hour-input" />
                    <input type="hidden" name="day" id="day-input" />

                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Zamknij</button>
                        <input type="submit" name="save" class="btn btn-primary" value="Zapisz" />
                    </div>
                </form>
            </div>

            <!--div id="result">s\res</div-->
        </div>
    </div>
</div>
<script type="text/javascript" >

    $('#addPlan').on('show.bs.modal', function (event) {
        var button = $(event.relatedTarget); // Button that triggered the modal
        var recipient = button.data('plan'); // Extract info from data-* attributes
        // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
        // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
        var modal = $(this);
        //modal.find('.modal-title').text('Lekcja ' + recipient);
        //modal.find('.modal-body input').val(recipient)
        var res = recipient.split('|');
        modal.find('#class-input').val(res[0]);
        modal.find('#day-input').val(res[1]);
        modal.find('#hour-input').val(res[2]);
    });

</script>