Я нашел скрипт проверки шага jQuery. Когда я запускаю приложение, следующий шаг не происходит. Я использую jQuery 3.3.1, jquery.steps, jquery-ui.min и jquery.validate. Итак, что мне не хватает?
<body>
<div class="page-content">
<div class="wizard-v2-content">
<div class="wizard-image">
</div>
<div class="wizard-form">
<div class="wizard-header">
<h3>Hello</h3>
</div>
<form id="form" class="form-register" method="post">
<div id="form-total">
<!-- SECTION 1 -->
<h2>1</h2>
<section>
<div class="inner">
<div class="form-row">
<div class="form-holder">
<select required class="form-control" name="note1" id="note1">
...a few selects
</select>
</div>
</div>
</div>
</section>
<!-- SECTION 2 -->
<h2>2</h2>
<section>
<div class="inner">
<div class="form-row">
<div class="form-holder">
<select required class="form-control" name="note2" id="note2">
...a few selects
</select>
</div>
</div>
</div>
</section>
<!-- SECTION 3 -->
<h2>3</h2>
<section>
<div class="inner">
<div class="form-row">
<div class="form-holder shadow-textarea">
<select name="classification[]" id="classification[]" class="mdb-select md-form" multiple>
...a few selects
</select>
<input type="text" id="justificativa" name="justificativa" class="form-control" maxlength="250">
</div>
</div>
</div>
</section>
</div>
</form>
</div>
</div>
</div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jquery.steps.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/main.js"></script>
</body>
var form = $("#form-total");
form.validate({
errorPlacement: function errorPlacement(error, element) {
element.before(error);
},
rules: {
"note1": {
required: true
}
}
});
form.steps({
headerTag: "h2",
bodyTag: "section",
transitionEffect: "fade",
enableAllSteps: true,
autoFocus: true,
transitionEffectSpeed: 700,
titleTemplate: '<span class="title">#title#</span>',
labels: {
previous: 'Back',
next: 'Next',
finish: 'Submit',
current: ''
},
onStepChanging: function(event, currentIndex, newIndex) {
form.validate().settings.ignore = ":disabled,:hidden";
return form.valid();
},
onFinished: function(event, currentIndex) {
$("#form").submit();
}
});
Валидация возвращает false
в onStepChanging
(form.valid()
). Я не могу изменить шаг, почему? Нужны ли другие теги?