2013-07-29 90 views
0

我正在使用jquery validationEngine進行表單驗證。但我無法驗證表單驗證密碼字段。它只是說「字段不匹配」,而我輸入相同的密碼以及驗證密碼字段。這裏是我的代碼,ValidationEngine密碼驗證問題

<link href="/js/jq_validation/validationEngine.jquery.css" rel="stylesheet" type="text/css" media="screen" /> 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script> 
<script src="/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine-en.js" type="text/javascript" ></script> 
<script src="/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine.js" type="text/javascript" ></script> 
<script> 
$(document).ready(function(){ 
    $(".test2").validationEngine(); 
}); 
</script> 


<!---<script src="{$strREQUEST_URI}/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine_old.js" type="text/javascript" ></script>--> 


     <form method="post" action="{$strSecureREQUEST_URI}/register?{$smarty.server.QUERY_STRING}" id="registerform1" name="registerform" class="test2"> 
      <div class="fname"> 
       <div class="txtl">Username:<span style="color:red;">&nbsp;*</span></div> 
        <div class="field"> 
         <input type="text" class="validate[required,length[0,100]] textfield" value="" name="user" id="user" data-errormessage-value-missing="* Username is required!" data-errormessage-custom-error="Let me give you a hint: someone.noone" /> 
        </div> 
      </div> 
      <div class="fname"> 
       <div class="txtl">Password:<span style="color:red;">&nbsp;*</span></div> 
        <div class="field"> 
         <input type="password" class="validate[required] text-input" value="" name="pass" id="password2" data-errormessage-value-missing="* Password is required!" /> 
        </div> 
      </div> 
      <div class="fname"> 
       <div class="txtl">Verify Password:<span style="color:red;">&nbsp;*</span></div> 
        <div class="field"> 
         <input type="password" class="validate[required,equals[password2]] text-input" value="" name="vpass" id="vpass" data-errormessage-value-missing="* Verification Password is required!" /> 
        </div> 
      </div> 
     </form> 

請幫我弄清楚這個問題!

+0

你的代碼是完美的,它必須成功運行,我也試過你的代碼的工作完美。 –

回答

0

我覺得你

name="pass" id="password2" 

應該是同樣喜歡

name="password2" id="password2" 
在提交的密碼

。如果您遇到任何問題,請告訴我。

UPDATE

我從您的代碼獲得了唯一的問題是

<input type="password" class="validate[required] text-input" value="" name="pass" id="password2" data-errormessage-value-missing="* Password is required!" /> 

應該像

<input type="password" class="validate[required] text-input" value="" name="password2" id="password2" data-errormessage-value-missing="* Password is required!" /> 
+0

不,我試過了。不工作! – MJQ

+0

請看看我的更新。這是我在你的代碼中發現的唯一問題 – ABorty

+0

再次嘗試,但仍然是相同的錯誤! – MJQ

1

確定。我得到了這個問題。我使用舊版本的驗證引擎文件。所以我更新了我的文件,它工作。此外,請注意形式和元素ID。他們應該是不同的。此外,參考上面的「Aritra Chakraborty」答案,名稱和ID不需要相同。請注意,如果您有多個帶密碼的表單並驗證密碼文件,請確保該名稱應該保持相同,如果多個表單提交到相同的鏈接並且ID應該不同!

0

對於檢查確認密碼最小字符驗證,那麼你可以使用

<input type="password" id="password" name="password" class="validate[required,minSize[8]]"/> 
<input type="password" id="confirm_password" name="confirm_password" class="validate[required,equals[password]]"/>