2012-05-11 25 views
0

我正在處理多步註冊表單。對於我創建的div與下一步的按鈕表單標籤內的每個步驟如下......帶位置絕對驗證引擎的多步註冊表單驗證

<form action="" method="POST"> 
<div class="registration_step_1 clearfix"> 
/*few form fields here such as username, password etc.*/ 

    /*Button to proceed to next step*/ 
    <button class="redBtn right_part step_btn">Next</button> 
</div> 

<div class="registration_step_2 clearfix"> 
/*few form fields here such as username, password etc.*/ 

    /*Button to proceed to next step*/ 
    <button class="redBtn right_part step_btn">Next</button> 
</div> 

<div class="registration_step_3 clearfix"> 
/*few form fields here such as username, password etc.*/ 

    /*Button to proceed to next step*/ 
    <button class="redBtn right_part step_btn">Next</button> 
</div> 


<div class="registration_step_4 clearfix"> 
/*few form fields here such as username, password etc.*/ 

    /*Button to proceed to next step*/ 
    <button class="redBtn right_part step_btn">Next</button> 
</div> 

<div class="registration_step_final clearfix"> 
<input type="submit" value="Register" class="redBtn round-button"> 
</div> 

</form> 

我使用的位置絕對形式驗證引擎。我們可以觸發驗證,如下所示: jQuery(「#formID」)。validationEngine();

問題是每一步可以有幾個所需的字段。對於最初處理嚮導,我只顯示第一步和顯示:沒有其他div。但是,在這種情況下,如果提交了第1步中的所有必填字段,表單將提交給服務器。

任何人,請建議如何處理這種情況。理想情況下,如果填寫了特定步驟的所有必填字段,則應進入下一步,不應提交,反之亦然。

感謝您的所有時間。

回答

2

防止從與JavaScript(這裏的jQuery)每個按鈕之後提交表單:

jQuery(".registration_step_1").click(function() { /*some code */ return false; });