带有联系人表单的HTML弹出窗口

时间:2019-04-20 07:37:16

标签: html django bootstrap-4

一个弹出窗口,当在Django中填写字段时显示成功消息,而在空白时显示失败消息

<form method="post" action="{% url 'giris:contact' %}">
   {% csrf_token %}
      {% for hidden in form.hidden_fields %}
      {{ hidden }}
      {% endfor %}

      {% for field in form.visible_fields %}
            <div class="form-group">
                {% render_field field class="form-control" %}
                {% if field.help_text %}
                <small class="form-text text-muted">{{ field.help_text }}</small>
                {% endif %}

            </div>
            {% endfor %}
        <input data-toggle="modal" data-target="#myModal" type="submit" value="send" />
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">Modal Header</h4>
            </div>
            <div class="modal-body">
              Some text in the modal.
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close
              </button>
            </div>
          </div>
        </div>
      </div>

如果用户填写联系表格并按下按钮,则我希望成功弹出窗口。如果您没有填充就按下按钮,我希望弹出窗口失败。你能帮我吗?

0 个答案:

没有答案