1

我正在尝试设置一个模式,使用引导程序获取错误或成功消息,但它没有被触发?如果填写了所有字段(没有成功消息),电子邮件将发送,如果一个或多个字段留空(没有成功消息)则不会发送?您可以在此处查看表格:

这个网站正在进行中,我对所有这些引导程序都是新手!

我错过了什么?

这是html和触发脚本:

  <div class="row">
      <div class="span8">
           <div id="formMode" class="modal fade">
              <div class="modal-header"></div>
              <div class="modal-body"></div>
              <div class="modal-footer"></div>
           </div>
           <form action="contact.php" method="POST" id="contactform" class="form-horizontal">
              <fieldset>
                 <legend>Please fill in the form bellow and a sales representive will be in contact swiftly.</legend>
              //form details
             </div>
           </fieldset>
          </form>
        </div>
     </div>
     <script type="text/javascript">
        $(document).ready(function () {
                var mode_value = getQuerystring('mode');

                switch (mode_value) {
                case '':
                $('#formMode').modal('hide');
                break
                case 'POST':
                $('.modal-header').html('h1>Form submitted...</h1>');
                $('.modal-body').html('<h2>Everything <em>seemed</em> to be correct.</h2>');
                $('.modal-footer').html('<a href="#" class="btn" data-dismiss="modal">Close</a>');
                $('#formMode').modal('show');
                break
                case 'success':
                $('.modal-header').html('');
                $('.modal-body').html('<div class="alert alert-block alert-success"><h4 class="alert-heading">Your message was sent</h4>We will respond to you shortly</div>');
                $('.modal-footer').html('<a href="index.html" class="btn btn-success" data-dismiss="modal">Close</a>');
                $('#formMode').modal('show');
                break
                case 'fail':
                $('.modal-header').html('');
                $('.modal-body').html('<div class="alert alert-block alert-error"><h4 class="alert-heading">The message was not sent</div>');
                $('.modal-footer').html('<a href="#" class="btn btn-danger" data-dismiss="modal">Close</a>');
        $('#formMode').modal('show');

                };
        })
     </script>
  </div>
4

1 回答 1

0

您必须在文档末尾放置后设置联系表单中的脚本行,以便页面加载更快的脚本。之后它对我有用。

于 2013-06-13T07:35:32.670 回答