模态不会触发来自验证的电子邮件,但是电子邮件发送 - 引导程序

时间:2012-12-26 07:11:00

标签: php jquery twitter-bootstrap

我正在尝试设置一个模态,使用bootstrap作为错误或成功消息,但它没有被触发?如果填写了所有字段(没有成功消息),电子邮件将发送,如果一个或多个字段留空(不成功消息),则不会发送?您可以看到表单here

这个网站正在进行中,我是所有这个引导的新手!

我错过了什么?

这是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>

1 个答案:

答案 0 :(得分:0)

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