0

我创建了具有一些字段的可折叠内容,并且我使用了 jquery.validationEngine.js进行验证。问题是当可折叠为真时,它不显示验证选项,但如果它为假,它可以正常工作我想要的是如果有可折叠内容中的错误应将 collapsible 设置为 false。

这是html页面的代码:

<div data-role="collapsible" id='collapsible_2' data-theme="b" data-content-theme="c" style="padding-bottom: 10px">
  <h3>Contact Information</h3>
  <p align="left" style="margin-bottom: 2px"><font color="#3C6FA1"><b>EMAIL ADDRESS</b></font></p>
   <hr>
  <input class="validate[required] text-input" id="email_id" name="emailId" type="text" placeholder="name@sample.com" >
  <p align="left" style="margin-bottom: 2px"><font color="#3C6FA1"><b>PHONE NUMBER</b></font></p>
   <hr>
  <input class="validate[required] text-input" id="main" name="main" type="number" min="0" max="9" maxlength="10" placeholder="Main" >
  <input class="validate[required] text-input" id="mobile" name="mobile" type="text" placeholder="Mobile" >
  <p align="left" style="margin-bottom: 2px"><font color="#3C6FA1"><b>FAX NUMBER</b></font></p>
   <hr>
  <input class="validate[required] text-input"id="fax" name="fax" type="text" placeholder="Fax" >
  <p align="left" style="margin-bottom: 2px"><font color="#3C6FA1"><b>WEBSITE</b></font></p>
   <hr>
  <input class="validate[required] text-input" id="website" name="website" type="text" placeholder="Website" >
  <p align="left" style="margin-bottom: 2px"><font color="#3C6FA1"><b>ADDRESS</b></font></p>
   <hr>
  <input class="validate[required] text-input" id="street_address" name="street_address" type="text" placeholder="Street Address">
  <input class="validate[required] text-input" id="city" name="city" type="text" placeholder="City">
  <input class="validate[required] text-input" id="Region" name="Region" type="text" placeholder="Region">
  <input class="validate[required] text-input" id="postal_code" name="postal_code" type="text" placeholder="Postal Code">
  <select name="select-choice-c" id="select-choice-c" data-native-menu="false" data-theme="a">
    <option>Select Country</option>
    <option value="standard">India</option>
    <option value="rush">Australia</option>
    <option value="express">England</option>
    <option value="overnight">SriLanka</option>
  </select>
</div>

这是我用过的java脚本:

jQuery(document).ready( function() {
 // binds form submission and fields to the validation engine
 jQuery("#formID").validationEngine();
});

这是我用于设计和验证的 js 和 css 文件:

<head>
  <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
  <link rel="stylesheet" href="css/template.css" type="text/css"/>
  <script src="js/jquery.js" type="text/javascript"></script>
  <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
  <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
  <link rel="stylesheet" href="contactcss/jquery.mobile-1.3.1.min.css"/>
  <script src="js/jquery.mobile-1.3.1.min.js"></script>
  <script type="text/javascript" charset="utf-8" src="js/cordova-2.7.0.js"></script>
</head>
4

1 回答 1

0

刚刚对 jquery.validationEngine.js 文件进行了一些更改,如下所示:

if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden")))
            return false;

至:

if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden")))
            return true;

并从:

validateNonVisibleFields: false,  lineNo:2008

至:

validateNonVisibleFields: true, 
于 2013-07-17T11:17:18.727 回答