标签中的联系表格7会添加到网址和重定向中,但不会提交

时间:2018-08-10 15:20:58

标签: jquery wordpress bootstrap-4 contact-form-7

我在Bootstrap选项卡中有一个联系表7。提交后,它会将表单提交添加到url中,但实际上并没有提交表单。

我猜想这与表单处理程序有关,但我不确定。下面的代码在重新加载时将页面加载到同一选项卡,从而完成了一部分。我只是无法提交表格。

$('.nav-item a').click(function(e) {
 e.preventDefault();
 $(this).tab('show');
});


$("ul.nav-tabs > li > a").on("shown.bs.tab", function(e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});

var hash = window.location.hash;
$('.nav-item a[href="' + hash + '"]').tab('show');  

下面的代码是表单的HTML

<ul class="nav nav-tabs" id="myTab" role="tablist">
      <li class="nav-item">
        <a class="nav-link active" id="contact_d-tab" data-toggle="tab" href="#contact_d" role="tab" aria-controls="contact_d" aria-selected="true">Contact Details</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" id="form-tab" data-toggle="tab" href="#form" role="tab" aria-controls="form" aria-selected="false">Contact Form</a>
      </li>
    </ul>
    <div class="tab-content" id="myTabContent">
      <div class="tab-pane fade show active" id="contact_d" role="tabpanel" aria-labelledby="contact_d-tab">
        <div class="contact_info">
          <h3>
            Contact Information
          </h3>
          <ul>
            <li>
              <i class="fas fa-user-circle"></i>&nbsp;<span>Council Clerk</span> - <?php the_field('clerk_name'); ?>
            </li>
            <li>
              <i class="fas fa-map-marker-alt"></i>&nbsp;<?php the_field('address', 'options'); ?>
            </li>
            <li>
              <i class="fas fa-phone"></i>&nbsp;<a href="tel:<?php the_field('phone', 'options'); ?>"><?php the_field('phone', 'options'); ?></a><br>
              <i class="fas fa-envelope"></i>&nbsp;<a href="mailto:<?php the_field('email', 'options'); ?>"><?php the_field('email', 'options'); ?></a>
            </li>
          </ul>

          <p class="info">You may contact any Colwall Parish Councillor by e-mailing the Clerk, who will forward any correspondence. Alternatively, all Councillor's details can be found below.</p>
        </div>
      </div>
      <div class="tab-pane fade" id="form" role="tabpanel" aria-labelledby="form-tab">
        <form>
          <h3>
            Contact Form
          </h3>
          <?php echo do_shortcode('[contact-form-7 id="618" title="Contact form"]'); ?>
        </form>
      </div>

谢谢您的帮助。

0 个答案:

没有答案