2014-09-13 37 views
0

我正在编码一步一步的形式。包括一个jquery脚本来划分我的表单。所以在第一种形式中,我必须只放一个按钮,这是下一个按钮,将客户端的下一个表格如何验证我的表单,如果点击下一个按钮

但我必须处理,如果我点击下一个按钮,我的第一种形式它会得到而不验证第一个表单中的部分。

下面的按钮代码

<input name="Next" type="submit" id='button1' value="Next" /> 

这里的jQuery脚本,我认为有,除了IM下一个标签在jQuery的并不好做。

$(".next").click(function(){ 

    if(animating) return false; 
animating = true; 

current_fs = $(this).parent(); 
next_fs = $(this).parent().next(); 

//activate next step on progressbar using the index of next_fs 
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active"); 

//show the next fieldset 
next_fs.show(); 
//hide the current fieldset with style 
current_fs.animate({opacity: 0}, { 
    step: function(now, mx) { 
     //as the opacity of current_fs reduces to 0 - stored in "now" 
     //1. scale current_fs down to 80% 
     scale = 1 - (1 - now) * 0.2; 
     //2. bring next_fs from the right(50%) 
     left = (now * 50)+"%"; 
     //3. increase opacity of next_fs to 1 as it moves in 
     opacity = 1 - now; 
     current_fs.css({'transform': 'scale('+scale+')'}); 
     next_fs.css({'left': left, 'opacity': opacity}); 
    }, 
    duration: 800, 
    complete: function(){ 
     current_fs.hide(); 
     animating = false; 
    }, 
    //this comes from the custom easing plugin 
    easing: 'easeInOutBack' 
}); 

的问题是如何去另一种形式,但与第一个验证。 由于事先

+0

请停止posti重复的问题。 – Sparky 2014-09-13 19:45:05

回答

1

表单验证可像这种形式的名称= “myForm的” 行动= “demo_form.asp”的onsubmit = “返回validateForm()”方法= “邮报”

的做validateform()函数只返回false:如果输入不是false,这种情况下的动作将进入demo_form.asp,在你的情况下将进入下一步...

一个很好的例子goto: http://www.w3schools.com/js/js_form_validation.asp

+0

它更复杂,因为它具有验证的形式已经如此,如果我把anohter放在划分我的表单的脚本上比它显示2,但我想要包含的验证或包含在我的例如index.html中的screipt代码是积极的有点困惑,我现在除了谢谢你的ansewer – Flamur 2014-09-13 17:51:28

相关问题