单击“下一步”按钮后如何验证我的表单
How to validate my form if next button clicked
我正在编写一个循序渐进的表单。其中包括一个jquery脚本,用于划分我的表单。所以在第一个表单中,我只需要放一个按钮,那就是下一个按钮来让客户进入下一个表单
但我必须处理的是,如果我点击第一个表单上的下一个按钮,它会转到另一个表单,而不会验证第一个表单中的部分。
这里的按钮编码
<input name="Next" type="submit" id='button1' value="Next" />
在这里,我认为除了我不擅长jquery之外,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'
});
问题是如何进入另一种形式,但要验证第一种形式。提前感谢
表单验证可以像以下表单name="myForm"action="demo_Form.asp"onsubmit="return validateForm()"method="post"一样完成
validateform()函数只返回false:如果输入不是false,则在这种情况下,操作将转到demo_form.asp,在您的情况下,将转到下一步。。。
举个好例子:http://www.w3schools.com/js/js_form_validation.asp
相关文章:
- 如何禁用在Bootstrap中不完成一步就转到下一步
- 将“下一步”和“上一个”按钮添加到较大的图像
- 引导表单向导 - 防止在提交 ajax 响应的每个页面表单出现错误时滚动到下一步
- 如何创建一个“下一步”按钮,使用 Java 脚本和 Twitter Bootstrap 切换选项卡
- 如何在单击下一步时使文本移动/更改
- 您如何控制在填写表单时单击下一步时 iOS/Android 将关注哪个字段
- Jquery UI选项卡-根据输入字段值,使用“下一步”/“上一步”按钮推进选项卡
- Jquery选项卡单击时高亮显示'下一步'按钮
- 如何解析用户对象以返回屏幕名称并继续下一步操作
- 如何点击谷歌饼图进入下一步行动
- 转到下一步时更改输入值
- 尝试在JavaScript中制作下一步按钮以显示JSON数组
- 跳转到 CasperJS 中步骤超时的下一步
- 如何在 UI 引导分页中禁用下一步按钮
- 等待几秒钟,然后再运行下一步量角器
- 如何在textField上使用zIndex,这样当我在Titanium中按下一步时,我可以移动到其他textField
- 到达最后一个元素时隐藏下一步按钮
- 通过单击“MVC 获取错误”中的“下一步”按钮 asp.net 在同一详细信息页面上显示记录
- 单击“下一步”按钮后如何验证我的表单
- 下一步对Ajax验证内容的字段进行有效性检查