2010-12-09 10 views
2

나는베이스 유효성 검증과 함께 formtowizard jquery 플러그인을 사용하고 있습니다. 나는 ... 난 단지는 현재 필드 셋이 아니라 전체 양식을 확인하려는 그러나 내 양식을 검증하는 클릭 이벤트에 내 옆에있는 버튼을 첨부필드 세트 사이의 유효성 검사

내 양식이

<form id="SignupForm" method="POST" action=".................."> 

    <fieldset> 
    <legend>Application</legend> 
     <div> 

     </div> 
    </fieldset> 

    <fieldset> 
    <legend>Step Two</legend> 
     <div> 

     </div> 
    </fieldset> 

이 같은 설정

나는 순간

$("a.next").click(function() { 
    $("#SignupForm").validate(); 
    }); 

이 내 버튼을

function createNextButton(i) { 
      var stepName = "step" + i; 
      $("#" + stepName + "commands").append("<a href='#' id='" + stepName + "Next' class='next'>Next</a>"); 

      $("#" + stepName + "Next").bind("click", function(e) { 
       /* VALIDATION */ 
       if (options.validationEnabled) { 
        var stepIsValid = true; 
        $("#"+stepName+" :input").each(function(index) { 
         checkMe = element.validate().element($(this)); 
         //stepIsValid = !element.validate().element($(this)) && stepIsValid; 
         stepIsValid = checkMe && stepIsValid; 
        }); 
        //alert("stepIsValid === "+stepIsValid); 
        if (!stepIsValid) { 
         return false; 
        }; 
       }; 

       $("#" + stepName).hide(); 
       $("#step" + (i + 1)).show(); 
       if (i + 2 == count) 
        $(submmitButtonName).show(); 
       selectStep(i + 1,'next'); 
      }); 
     } 
을 호출되는 곳이다에서 사용하고 있는지어떤 아이디어? 나는 다른 사람이 알고 싶다면 내 문제를 해결하기 위해 관리했습니다 확인

+0

모든 아이디어를 누구? –

답변

1

...

function createNextButton(i) { 
    var stepName = "step" + i; 
    $("#" + stepName + "commands").append("<a href='#' id='" + stepName + "Next' class='next'>Next</a>"); 

    $("#" + stepName + "Next").bind("click", function(e) { 

     if (options.validationEnabled) { 
      var stepIsValid = true; 
      $("#"+stepName+" :input").each(function(index) { 
       checkMe = element.validate().element($(this)); 
       //stepIsValid = !element.validate().element($(this)) && stepIsValid; 
       stepIsValid = checkMe && stepIsValid; 
      }); 
      alert("stepIsValid === "+stepIsValid); 
      if (!stepIsValid) { 
       return false; 
      }; 
     }; 

     $("#" + stepName).hide(); 
     $("#step" + (i + 1)).show(); 
     if (i + 2 == count) 
      $(submmitButtonName).show(); 
     selectStep(i + 1,'next'); 
    }); 
} 
관련 문제