0

我正在用 cakephp 开发一个网站。

n footer.ctp 查看页面加载的所有 js 文件。

这是我的页脚页面:

<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery-1.9.1.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="<?php echo BASE_URL;?>js/modernizr.custom.17475.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery.selectbox-0.5.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>js/stickytooltip.js"></script>
<script src="<?php echo BASE_URL;?>js/event-menu.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/custom-sub.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/custom.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/map.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/easyResponsiveTabs.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/jquery.tagcloud.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/html5.js" type="text/javascript"></script>
<script type="text/javascript">
//$('#Select_Access_1').selectbox();
$(function () {
    var total_ul_count = "";
    if($("#total_ul_count")) {
        total_ul_count = $("#total_ul_count").val();
    }

    if(total_ul_count) {
        var arr = total_ul_count.split(',');
        $.each(arr, function(key, value) {
                $('#Select_Access_'+value).selectbox();
        });
    }

    $(".delete_row").on('click', function () {
        var myid = $(this).attr('id');
        var my_i_val = myid.substring(13);

        delete_subscribe_emails(my_i_val);

        $("#li_"+my_i_val).remove();
        var count_str = $("#total_ul_count").val();
        arr = count_str.split(',');
        arr = jQuery.grep(arr, function(value) {
          return value != my_i_val;
        });
        arr_str = arr.join();
        $("#total_ul_count").val(arr_str);
  });   

  $(".delete-subscribes").on('click', function () {
        var myid = $(this).attr('id');
        var my_i_val = myid.substring(7);

        delete_notify_emails(my_i_val);

        $("#subscribe_"+my_i_val).remove();
        var count_str = $("#Subcribes_list_numbers").val();
        arr = count_str.split(',');
        arr = jQuery.grep(arr, function(value) {
          return value != my_i_val;
        });
        arr_str = arr.join();
        $("#Subcribes_list_numbers").val(arr_str);
 });
});
</script>


<script src="<?php echo BASE_URL;?>js/common-scripts1.0.js" type="text/javascript"></script>
<script src="<?php echo BASE_URL;?>js/JQValidation/jquery-1.8.3.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
        $("#Add_Organization").validate({
           submitHandler: function(form) {
               //window.location='http://go.registerguard.com/entertainment/';
               alert(1);
               return false;
             },
        });



});

var jQuerX = jQuery.noConflict();
</script>

现在一切都在工作,但 submitHandler 不工作。

我们第一次遇到这个问题...

所以这个问题对我来说很奇怪......

我该如何解决这个问题,我们也尝试了非冲突,但仍然有问题。

更新

我们正在使用响应式标签。因此,jquery validate 可能工作也可能不工作。我 jquery validate 工作,然后选项卡不工作。如果选项卡工作,那么验证不起作用......

这是查看页面:

<div class="clear"></div>
      <div class="organization-details-content">
        <aside>
          <div id="organizationTab">
          <?php
          if(isset($this->request->data['Organization']) && $this->request->data['Organization']['id'] != "") {
                echo $this->Form->input('Organization.id', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'OrganizationId',
                                                                    'type' => 'hidden',
                                                                    'class'=>'input-field',
                                                                    'readonly' => 'readonly')); 
          } else { 
                echo $this->Form->input('Organization.id', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'OrganizationId',
                                                                    'type' => 'hidden',
                                                                    'class'=>'input-field',
                                                                    'readonly' => 'readonly')); 
          }
          echo $this->Form->input('Organization.tab2', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'OrganizationTab2',
                                                                    'type' => 'hidden',
                                                                    'value'=>$tab2,
                                                                    'class'=>'input-field',
                                                                    'readonly' => 'readonly')); 
          ?>

            <ul class="resp-tabs-list">
              <li id="basicinfo-tab">Basic Information</li>
              <li id="analytics-tab">Analytics</li>
            </ul>
            <div class="resp-tabs-container">
              <div id="basicinfo">
              <?php echo $this->Form->create('Organization', array('id' => 'Add_Organization','nonvalidate'=>'nonvalidate')); ?>
                <div class="organization-details">
                  <h1>Basic Information</h1>
                  <p><strong>Your organization will be your public face on Central Ticketing Sales, promotions and reporting will be managed through your organization.</strong></p>
                  <div class="basic_info">
                    <ul>
                      <li><span class="org1"><img src="<?php echo $this->webroot; ?>images/create-org1.png" alt="1" /></span>Create an Organization</li>
                      <li><span class="event2"><img src="<?php echo $this->webroot; ?>images/create-event2.png" alt="2" /></span>Create an Event</li>
                      <li><span class="tickets"><img src="<?php echo $this->webroot; ?>images/sell-ticket3.png" alt="2" /></span>Sell Tickets</li>
                    </ul>
                    <div class="clear"></div>
                  </div>
                  <div class="organization_field">
                    <label>What is the name of your Organization</label>
                    <div class="org_field">
                      <?php echo $this->Form->input('Organization.name', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'name',
                                                                    'type' => 'text',
                                                                    'class'=>'input-field')); ?>
                      <span> This could be the name of your company, non-profit, group, school, etc.</span> </div>
                    <div class="clear"></div>
                  </div>
                  <div class="clear"></div>
                </div>
                <div class="organization-details">
                  <h2>Contact Information for Central Tickets</h2>
                  <p>Please enter the email and phone number through which you would like CentralTicket to contact your organization. </p>
                  <div class="organization_field">
                    <div class="filed-margin-bottom">
                      <label class="label-width">Email</label>
                      <div class="org_field">
                        <?php 
                        if(isset($this->request->data['Organization']) && $this->request->data['Organization']['company_email'] != "") {
                            echo $this->Form->input('Organization.company_email', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'company_email',
                                                                    'type' => 'text',
                                                                    'class'=>'input-field'));
                        } else {
                            echo $this->Form->input('Organization.company_email', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'company_email',
                                                                    'type' => 'text',
                                                                    'value'=> 'abcd@email.com',
                                                                    'onblur'=>"javascript:if(this.value==''){this.value='abcd@email.com'}",
                                                                    'onfocus'=>"javascript:if(this.value=='abcd@email.com'){this.value=''}",
                                                                    'class'=>'input-field'));
                        }
                         ?>
                      </div>
                      <div class="clear"></div>
                    </div>
                    <div class="filed-margin-bottom">
                      <label class="label-width">Phone</label>
                      <div class="org_field">
                        <?php 
                        if(isset($this->request->data['Organization']) && $this->request->data['Organization']['contact_phone'] != "") {
                            echo $this->Form->input('Organization.contact_phone', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'contact_phone',
                                                                    'type' => 'text',
                                                                    'class'=>'input-field'));
                        } else {
                            echo $this->Form->input('Organization.contact_phone', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'contact_phone',
                                                                    'type' => 'text',
                                                                    'value'=> '+971502504858',
                                                                    'onblur'=>"javascript:if(this.value==''){this.value='+971502504858'}",
                                                                    'onfocus'=>"javascript:if(this.value=='+971502504858'){this.value=''}",
                                                                    'class'=>'input-field'));
                        }
                         ?>
                      </div>
                      <div class="clear"></div>
                    </div>
                    <div class="filed-margin-bottom">
                    <label class="label-width label-hide">&nbsp;</label>
                      <div class="button-container">
                       <?php echo $this->Form->input('Page.step', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'step',
                                                                    'type' => 'hidden',
                                                                    'readonly' => 'readonly',
                                                                    'value'=> 'basicinfo',
                                                                    'class'=>'input-field')); ?>
                        <?php echo $this->Form->submit('Save Changes', array('div'=>false, 
                                                                            'name'=>'basicinfo_save',
                                                                            'id'=>'basicinfo_save', 
                                                                            'type' => 'submit', 
                                                                            'class'=>'org-button')); ?>
                      </div>
                    </div>
                  </div>
                  <div class="clear"></div>
                </div>
                <?php echo $this->Form->end(); ?>
              </div>
              <!--1st Tab conent end here-->

              <!--2nd Tab conent end here-->

              <div id="analytics">
               <?php echo $this->Form->create('Add_Organization_Web', array('id' => 'Add_Organization_Web')); ?>
                <div class="organization-details">
                  <h1>Analytics</h1>
                  <h3>Google Analytics Tracking </h3>
                  <p>You can use Google Analytics to track your events. To set up Google Analytics for your organization:</p>
                  <ul class="tracking-list">
                    <li>Follow our Google Analytics Tracking How-to to set up your domain.</li>
                    <li>Enter your Google Analytics Web Property ID below.</li>
                  </ul>
                  <p>We will immediately start sending visitor and transaction data to your Google Analytics account. It can take up to a day for your traffic to show up in your Google Analytics account.</p>
                  <p>Sending visitor and transaction data to Google Analytics relies on the browser of your visitors. There are no guarantees that a visitor's browser will have the capabilities required for sending this data to Google Analytics. Some discrepancies may arise between the statistics in Google Analytics and in your Central Ticketing admin.</p>
                  <div class="organization_field">
                    <div class="filed-margin-bottom">
                      <label class="label-width">Web Property ID </label>
                      <div class="org_field margin">
                        <?php echo $this->Form->input('Organization.Web_ID', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'Web_ID',
                                                                    'type' => 'text',
                                                                    'class'=>'input-field')); ?>
                      </div>
                      <div class="clear"></div>
                    </div>
                    <div class="filed-margin-bottom">
                       <label class="label-width label-hide">&nbsp;</label>
                      <div class="button-container">
                        <?php echo $this->Form->input('Page.step', array('div'=>false, 
                                                                    'label'=>false,
                                                                    'id'=>'step',
                                                                    'type' => 'hidden',
                                                                    'readonly' => 'readonly',
                                                                    'value'=> 'webinfo',
                                                                    'class'=>'input-field')); ?>

                        <?php echo $this->Form->submit('Save Changes', array('div'=>false, 
                                                                            'name'=>'webinfo_save',
                                                                            'id'=>'webinfo_save', 
                                                                            'type' => 'button', 
                                                                            'class'=>'org-button')); ?>
                      </div>
                    </div>
                  </div>
                  <div class="clear"></div>
                </div>
                <?php echo $this->Form->end(); ?>
              </div>
              <!--4nd Tab conent end here--> 

            </div>
          </div>
        </aside>
      </div>
4

1 回答 1

0

我认为您已经加载了一个 jquery 库版本1.9+,因此无需再次加载另一个库。看到你有这个:

<script type="text/javascript" src="<?php echo BASE_URL;?>js/jquery-1.9.1.min.js">
</script>

库已经加载,所以你不必加载这个库:

<script src="<?php echo BASE_URL;?>js/JQValidation/jquery-1.8.3.js" type="text/javascript">
</script>

您可以尝试更改此行:

jQuery(document).ready(function($) {
于 2013-11-11T12:42:53.980 回答