2012-07-01 3 views
0

jquery 양식 마법사를 사용하여 두 단계로 양식을 표시합니다. 두 번째 단계로 진행하기 전에 jquery 양식 플러그인을 사용하여 1 단계에서 양식 필드의 Ajax 유효성 검사를 수행합니다.첫 번째 단계 후 jquery formwizard stop form plugin (ajax)

문제는 전체 양식도 ajax를 사용하여 게시된다는 것입니다. 결과를 보여주는 다른 페이지로 리디렉션하는 대신 결과가 동일한 페이지에서 가져옵니다. 아약스를 사용하지 않고 양식을 게시하도록 양식 플러그인을 구성하려면 어떻게해야합니까?

<script type="text/javascript"> 
        $(function(){ 
          $("#Catering").formwizard({ 
      formPluginEnabled: true, 
      validationEnabled: true, 
      focusFirstInput : true, 
      remoteAjax : {"first" : { // add a remote ajax call when moving next from the second step 
        url : "/validate", 
        dataType : 'json', 
        beforeSend : function(){alert("Starting validation.")}, 
        complete : function(){alert("Validation complete.")}, 
        success : function(data){ 
        if(!(data.geldig)){ // change this value to false in validate.html to simulate successful validation 
        $("#status").fadeTo(500,1,function(){ 
        $(this).html(data.errormessage) 
            }); 
          return false; //return false to stop the wizard from going forward to the next step (this will always happen) 
            } 
          return true; //return true to make the wizard move to the next step 
          } 
        }}, 
          } 
          ); 
      }); 


</script> 

답변

0

당신이 마음은 어디서든로 리디렉션 할 수 있으며 양식 캡처 변수가

그래서 난이 부분

해결할 $의 .PARAM (데이터)에 저장됩니다 formoptions에서 축복하는 URL 당신의 variabes를 노출하지 말아 경우
formOptions: { 
    success: function(data){ $("#status").fadeTo(500,1,function(){ $(this).html("You are now registered!").fadeTo(5000, 0); 
    beforeSubmit: function(data){ 

     $("#data").html("data sent to the server: "+ $.param(data)); 
     /*HERE YOU MADE THE REDIRECTION WITH THE VARIABLES THROUGHT URL*/ 
     window.location.href = "http://www.google.com?"+$.param(data); 
    }, 
    dataType: 'json' 
} 
당신이하고있는

그래서 beforeSubmit 모든 URL

와 매개 변수 anypage로 리디렉션입니다