这是一个用于创建选项卡式表单的简单脚本,我是从Web中的某个位置复制的。每当我提交时,在最后一步,它会抛出警告,表单已提交。我希望表单在表单的操作中提交到url。 通话类:
$(".number-tab-steps").steps({
headerTag: "h6",
bodyTag: "fieldset",
transitionEffect: "fade",
titleTemplate: '<span class="step">#index#</span> #title#',
labels: {finish: "Submit"},
onFinished: function (a, b) {
alert("Form submitted.")
}
}), $(".icons-tab-steps").steps({
headerTag: "h6",
bodyTag: "fieldset",
transitionEffect: "fade",
titleTemplate: '<span class="step">#index#</span> #title#',
labels: {finish: "Submit"},
onFinished: function (a, b) {
alert("Form submitted.")
}
}), $(".vertical-tab-steps").steps({
headerTag: "h6",
bodyTag: "fieldset",
transitionEffect: "fade",
stepsOrientation: "vertical",
titleTemplate: '<span class="step">#index#</span> #title#',
labels: {finish: "Submit"},
onFinished: function (a, b) {
alert("Form submitted.")
}
});
var form = $(".steps-validation").show();
$(".steps-validation").steps({
headerTag: "h6",
bodyTag: "fieldset",
transitionEffect: "fade",
titleTemplate: '<span class="step">#index#</span> #title#',
labels: {finish: "Submit"},
onStepChanging: function (a, b, c) {
return b > c || !(3 === c && Number($("#age-2").val()) < 18) && (b < c && (form.find(".body:eq(" + c + ") label.error").remove(), form.find(".body:eq(" + c + ") .error").removeClass("error")), form.validate().settings.ignore = ":disabled,:hidden", form.valid())
},
onFinishing: function (a, b) {
return form.validate().settings.ignore = ":disabled", form.valid()
},
onFinished: function (a, b) {
alert("Submitted!")
}
}), $(".steps-validation").validate({
ignore: "input[type=hidden]",
errorClass: "danger",
successClass: "success",
highlight: function (a, b) {
$(a).removeClass(b)
},
unhighlight: function (a, b) {
$(a).removeClass(b)
},
errorPlacement: function (a, b) {
a.insertAfter(b)
},
rules: {email: {email: !0}}
}), $(".datetime").daterangepicker({timePicker: !0, timePickerIncrement: 30, locale: {format: "MM/DD/YYYY h:mm A"}});
任何帮助都将深表感谢。感谢
答案 0 :(得分:0)
通过更改
完成alert("Submitted!")
到
return form.submit()