2013-12-12 32 views
0

我正在使用jquery-steps插件 in my project.Initially選項卡工作正常,但是當我寫驗證腳本都選項卡和驗證不工作。是否有任何需要引用jquery驗證程序插件在我的項目。任何幫助,將不勝感激。無法使用jquery-steps插件驗證文本框?

我已經使用的代碼如下

<head runat="server"> 
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/base/jquery-ui.css" /> 
<link href="css/jquery.steps.css" rel="stylesheet" type="text/css" /> 
<link href="css/main.css" rel="stylesheet" type="text/css" /> 
<link href="css/normalize.css" rel="stylesheet" type="text/css" />  
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script> 
<script src="scripts/jquery.steps.js" type="text/javascript"></script> 
<script src="scripts/jquery.steps.min.js" type="text/javascript"></script> 
<title></title> 
</head> 
<body> 
<script type="text/javascript"> 
$(function() { 
    $("#form1").steps({ 
     headerTag: "h2", 
     bodyTag: "fieldset", 
     transitionEffect: "slideLeft", 
     onStepChanging: function(event, currentIndex, newIndex) { 
      $("#form1").validate().settings.ignore = ":disabled,:hidden"; 
      return $("#form1").valid(); 
     }, 
     onFinishing: function(event, currentIndex) { 
      $("#form1").validate().settings.ignore = ":disabled"; 
      return $("#form1").valid(); 
     }, 
     onFinished: function(event, currentIndex) { 
      alert("Submitted!"); 
     } 
    }).validate({ 
     errorPlacement: function(error, element) { 
      element.before(error); 
     }, 
     rules: { 
      confirm: { 
       equalTo: "#password" 
      } 
     } 
    });    

}); 
</script> 
<form id="form1" runat="server">   
      <h2>First Step</h2> 
      <fieldset> 
        <legend> First Step Info </legend> 
        <label for="userName">User name *</label> 
        <input id="userName" name="userName" type="text" class="required"> 
        <label for="password">Password *</label> 
        <input id="password" name="password" type="text" class="required"> 
        <label for="confirm">Confirm Password *</label> 
        <input id="confirm" name="confirm" type="text" class="required"> 
        <p>(*) Mandatory</p> 

      </fieldset> 

      <h2>Second Step</h2> 
      <fieldset> 
       <legend>Second Step Info</legend> 
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut nulla nunc. Maecenas arcu sem, hendrerit a tempor quis, 
        sagittis accumsan tellus. In hac habitasse platea dictumst. Donec a semper dui. Nunc eget quam libero. Nam at felis metus. 
        Nam tellus dolor, tristique ac tempus nec, iaculis quis nisi. 

      </fieldset>            
</form> 

+0

http://stackoverflow.com/help/on-topic:關於你已經寫了必須_describe具體problem_代碼問題的問題 - 和包括有效的代碼複製它 - 在這個問題本身。請參閱http://SSCCE.org獲取指導。 – Sparky

回答

2

問題solved.My的猜測給出了right.I需要引用jQuery的驗證腳本到項目,現在驗證工作正常。

我參考的網站是jquery-steps