Javascript 步骤向导和欧芹未验证
我在wizard.js文件中为我的表单提供了jquery步骤函数Javascript 步骤向导和欧芹未验证,javascript,jquery,wizard,parsley.js,Javascript,Jquery,Wizard,Parsley.js,我在wizard.js文件中为我的表单提供了jquery步骤函数 $("#wizard-validate").steps({ headerTag: ".wizard-title", bodyTag: ".wizard-container", transitionEffect: "fade", onStepChanging: function (event, currentIndex, newIndex) { if (currentIndex >
$("#wizard-validate").steps({
headerTag: ".wizard-title",
bodyTag: ".wizard-container",
transitionEffect: "fade",
onStepChanging: function (event, currentIndex, newIndex) {
if (currentIndex > newIndex) {
return true;
}
if (newIndex === 3 && Number($("#age-2").val()) < 18) {
return false;
}
if ((currentIndex === 0)) {
return $(this).parsley();
}
},
onStepChanged: function (event, currentIndex, priorIndex) {
if (currentIndex === 2 && Number($("#age-2").val()) >= 18) {
$("#form-3").steps("next");
}
if (currentIndex === 2 && priorIndex === 3) {
$("#form-3").steps("previous");
}
},
onFinishing: function (event, currentIndex, newIndex) {
return $(this).parsley().validate();
},
onFinished: function () {
alert("submitted!");
}
});
而且这不是在验证表单。。继续下一步
我的表格是:
<form class="form-horizontal form-bordered" action="" data-parsley-validate id="wizard-validate">
<!-- Wizard Container 1 -->
<span class="response"></span>
<div class="wizard-title">Details</div>
<div class="wizard-container">
<input type="text" name="title" required value="" class="form-control">
<input type="text" name="location" required class="form-control" value="" >
<input type="text" class="form-control" required id="datepicker1" name="startdate" value="" />
<input type="text" class="form-control" required id="time-picker" name="starttime" value="" />
<input type="text" class="form-control" required id="datepicker2" name="enddate" value="" />
<input type="text" class="form-control" required id="time-picker2" name="endtime" value="" />
</div>
<!--/ Wizard Container 1 -->
<!-- Wizard Container 2 -->
<div class="wizard-title">Details 2</div>
<div class="wizard-container"></div>
<!--/ Wizard Container 2 -->
</form>
什么也没发生。。只是进入下一步,仅此而已。。
已尝试完整属性,如:data parsley required或data parsley required=true
我的js文件的顺序包括:
1.jquery.js
2.欧芹
3.jquery.steps.js
4.wizard.js我找到了解决方案:
向导功能和欧芹检查在哪里
退回$this.parsley;需要更改为return$this.parsley.validate;而且效果很好 您是否正在验证每个步骤?你的解决方案在我的情况下不起作用