2012-05-11 29 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

防止(ここでjQueryの)JavaScriptで各ボタンの後に提出からフォーム:

jQuery(".registration_step_1").click(function() { /*some code */ return false; }); 
関連する問題