开启代码之旅 Launch With Code


115 浏览 1 year

21 Update Email Form Design to Bootstrap Inline Form

版权声明: 转载请注明出处 http://www.codingsoho.com/

将email从form.as_p改到bootstrap内联的form
http://getbootstrap.com/css/#forms

<div class='container' style='text-align:center' " >
  <div class='col-sm-6 col-sm-offset-3'>
    <h1> Welcome Home! </h1>
    <form class='form-horizontal' method="POST" action=""> {% csrf_token %}
      <div class='form-group form-group-lg'>
        {% if form.email.errors %}
        {% for err in form.email.errors %}
          <div class="alert alert-danger" role="alert">{{ err }}</div>
          <div class="alert alert-danger" role="alert">Your Email is required</div>
        {% endfor %}
        {% endif %}
....         
        <div class="input-group">
          <input class='form-control' type="email" name="email" placeholder="Your email..." />
          <span class='input-group-btn'>
            <input type='submit' value='Join' class='btn btn-primary btn-lg' />
          </span>
        </div>
      </div>
    </form>
  </div>
</div>