1

我从https://github.com/posabsolute/jQuery-Validation-Engine下载了 Jquery 验证引擎,它在 IE 和 Firefox 中运行良好,但在 Chrome 和 Safari 上无法运行,问题是它是否无关紧要字段为空或输入无效字符,表单将始终提交,并且由于我使用 php 将数据输入数据库,因此字段输入为空。

我确信我包含了所有需要的脚本;您是否阅读过任何其他成员在使用该插件时遇到 chrome 和 Safari 问题?我将非常感谢您的帮助 Pals。

在编辑中添加代码(对不起朋友):

  <!doctype html>
  <html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
<link rel="stylesheet" href="css/template.css" type="text/css"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
<script src="js/jquery-1.8.2.min.js" type="text/javascript">
</script>
<script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
</script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
</script>
<script>
    jQuery(document).ready(function(){
        // binds form submission and fields to the validation engine
        jQuery("#collect").validationEngine('attach');
    });
</script>
</head>

<body  onLoad="formReset()" onUnload="formReset()">
<script>
function formReset()
 {
 document.getElementById("collect").reset();
 }
</script>
<div class="formholder">
  <form id="collect" class="formular" method="post" action="insert.php">
<fieldset>
      <label>
    <input value="" data-prompt-position="topRight:0,20"  class="validate[required,custom[onlyLetterSp]] text-input" type="text" name="nombre"  />
  </label>
      <br/>
      <label>
    <input value=""  class="validate[required,custom[email]] text-input" data-prompt-position="topRight:0,20"  type="text" name="email"  />
  </label>
      <br/>
      <label>
    <input value="" data-prompt-position="topRight:0,20"   class="validate[required,custom[phone]] text-input" type="text" name="telefono"  />
  </label>
      <br/>
      <label>
    <select style="height:35px; width:200px;" name="informacion" class="select"  form="contact-form" type= "select">
          <option value="option1">option1</option>
          <option value="option2">option2</option>
          <option value="option3">option3</option>
          <option value="option4">option4</option>
          <option value="option5">option5</option>
        </select>
   </label>
      <input  class="submit" type="submit" value= ""/>
    </fieldset>
    <hr/>
 </form>
   </div>
   </body>
   </html>
4

1 回答 1

1

看到这个代码

它现在正在工作......

 <!doctype html>
  <html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
    <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" />
    <script src="js/jquery-1.8.2.min.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>
<script>
        jQuery(document).ready(function(){
            // binds form submission and fields to the validation engine
            jQuery("#collect").validationEngine('attach');
    });
</script>
</head>

<body  onLoad="formReset()" onUnload="formReset()">
<script>
function formReset()
 {
 document.getElementById("collect").reset();
 }
</script>
<div class="formholder">
  <form id="collect" class="formular" method="post" action="insert.php">
<fieldset>
      <label>
    <input value="" data-prompt-position="topRight:0,20"  class="validate[required] text-input" type="text" name="nombre"  />
  </label>
      <br/>
      <label>
    <input value=""  class="validate[required] text-input" data-prompt-position="topRight:0,20"  type="text" name="email"  />
  </label>
      <br/>
      <label>
    <input value="" data-prompt-position="topRight:0,20"   class="validate[required] text-input" type="text" name="telefono"  />
  </label>
      <br/>
      <label>
    <select style="height:35px; width:200px;" name="informacion" class="select"  form="contact-form" type= "select">
          <option value="option1">option1</option>
          <option value="option2">option2</option>
          <option value="option3">option3</option>
          <option value="option4">option4</option>
          <option value="option5">option5</option>
        </select>
   </label>
      <input  class="submit" type="submit" value= "test"/>
    </fieldset>
    <hr/>
 </form>
   </div>
   </body>
   </html>
于 2013-05-14T09:10:48.887 回答