Blame view

assets/js/pages/form-wizard.js 1.52 KB
cf76164e6   Ting Chan   20190709
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  $( document ).ready(function() {
      var form = $("#example-form");
      var validator = $("#example-form").validate({
          errorPlacement: function errorPlacement(error, element) { element.after(error); },
          rules: {
              confirm: {
                  equalTo: "#password"
              }
          }
      });
      form.children("div").steps({
          headerTag: "h3",
          bodyTag: "section",
          transitionEffect: "fade",
          onStepChanging: function (event, currentIndex, newIndex)
          {
              form.validate().settings.ignore = ":disabled,:hidden";
              return form.valid();
          },
          onFinishing: function (event, currentIndex)
          {
              form.validate().settings.ignore = ":disabled";
              return form.valid();
          },
          onFinished: function (event, currentIndex)
          {
              alert("Submitted!");
          }
      });
      
      $(".wizard .actions ul li a").addClass("waves-effect waves-blue btn-flat");
      $(".wizard .steps ul").addClass("tabs z-depth-1");
      $(".wizard .steps ul li").addClass("tab");
      $('ul.tabs').tabs();
      $('select').material_select();
      $('.select-wrapper.initialized').prev( "ul" ).remove();
      $('.select-wrapper.initialized').prev( "input" ).remove();
      $('.select-wrapper.initialized').prev( "span" ).remove();
      $('.datepicker').pickadate({
          selectMonths: true, // Creates a dropdown to control month
          selectYears: 15 // Creates a dropdown of 15 years to control year
      });
  });