0

So I'm making a form with jQuery Steps but select isn't working properly. When I pick from the dropdown, nothing happens. The default option is still the one that is selected.

I'm using https://developer.snapappointments.com/bootstrap-select/ for the selection.

js code:

$('#wizard_vertical').steps({
    headerTag: 'h3',
    bodyTag: 'section',
    transitionEffect: 'slideLeft',
    stepsOrientation: 'vertical',
    onInit: function (event, currentIndex) {
        setButtonWavesEffect(event);
    },
    onStepChanged: function (event, currentIndex, priorIndex) {
        setButtonWavesEffect(event);
    }
});

Also, select works properly outside the form.

I really have no idea how to fix this so help will be greatly appreciated.

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Nytraxaqw
  • 55
  • 7
  • What's `jQuery Steps`? Can you make a snippet (edit and click `[<>]`) with all the relevant `script src=` and ` – freedomn-m Mar 29 '21 at 08:59
  • @freedomn-m http://www.jquery-steps.com/ also by not working properly I mean I can't select anything – Nytraxaqw Mar 29 '21 at 09:02
  • I've added the tags to the question for you - which version of bootstrap as it seems to be relevant, probably which version of jquery as well. (hence the request for a snippet with *all* relevant `script src=`) – freedomn-m Mar 29 '21 at 09:04
  • 1
    @freedomn-m i'm using bootstrap v3.3.6 jquery v1.12.4 and jquery steps v1.1.0 – Nytraxaqw Mar 29 '21 at 09:08

1 Answers1

1

I seem to have stumbled upon the same issue, did you manage to find a solution?

I did my own troubleshooting and came to the same conclusion that the select doesn't show the preselected value nor any other selected option in the form; But outside of the form it did work fine and displayed the selected value as expected.

These are my includes:

<link rel="stylesheet" 
    href="https://cdn.materialdesignicons.com/4.8.95/css/materialdesignicons.min.css"/>
<link rel="stylesheet" 
    href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="assets/css/bd-wizard.css" />
<link rel="stylesheet" href="assets/css/config.css" />
...
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<!-- jQuery Steps Version: v1.1.0 -->
<script src="assets/js/jquery.steps.min.js"></script>
<script src="assets/js/bd-wizard.js"></script>

bd-wizard.css:

body {
  font-family: "Karla", sans-serif;
  background-color: #f2f3f8;
}

/* Wizard */
.wizard a:hover {
  text-decoration: none;
}

.wizard .audible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wizard .steps > ul {
  list-style: none;
  padding-left: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
  justify-content: space-between;
  margin-bottom: 0;
}
.wizard .steps > ul li {
  width: 270px;
  max-width: calc(15% - 3px);
}
.wizard .steps > ul li a {
  display: inline-block;
  width: 100%;
  height: 100%;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-color: rgba(153, 155, 163, 0.1);
  padding: 28px 30px 24px;
}
@media (max-width: 767px) {
  .wizard .steps > ul li a {
    padding: 15px 10px;
  }
}
/* @media (max-width: 767px) {
  .wizard .steps > ul li a .media {
    display: block;
  }
} */

.wizard .steps > ul li .bd-wizard-step-title {
  line-height: 1;
  font-size: 18px;
  font-weight: bold;
  color: #000000;
}
/* @media (max-width: 767px) {
  .wizard .steps > ul li .bd-wizard-step-title {
    display: none;
  }
} */
.wizard .steps > ul li .bd-wizard-step-subtitle {
  line-height: 1;
  font-size: 14px;
  color: #c8c8c8;
}
@media (max-width: 767px) {
  .wizard .steps > ul li .bd-wizard-step-subtitle {
    display: none;
  }
}

.wizard .steps > ul li.current a {
  background-color: #fff;
}

.wizard .content {
  padding: 100px 35px 20px 35px;
  background-color: #fff;
  min-height: 420px;
}
@media (max-width: 767px) {
  .wizard .content {
    padding-left: 20px;
    padding-right: 20px;
    min-height: auto;
  }
}
.wizard .content .title {
  display: none;
}
.wizard .content .content-wrapper {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.wizard .content .section-heading {
  font-weight: bold;
  color: #030303;
  margin-bottom: 22px;
}
.wizard .content p {
  font-size: 16px;
  color: #030303;
}
.wizard .content .form-control {
  padding: 26px 25px;
  min-height: 50px;
  max-width: 550px;
  border-radius: 4px;
  border: solid 1px #ececec;
}
.wizard .content .form-control::-webkit-input-placeholder {
  color: #919aa3;
}
.wizard .content .form-control::-moz-placeholder {
  color: #919aa3;
}
.wizard .content .form-control:-ms-input-placeholder {
  color: #919aa3;
}
.wizard .content .form-control::-ms-input-placeholder {
  color: #919aa3;
}
.wizard .content .form-control::placeholder {
  color: #919aa3;
}

.wizard .actions {
  padding: 0 35px 35px;
  background-color: #fff;
}
@media (max-width: 767px) {
  .wizard .actions {
    padding-left: 20px;
    padding-right: 20px;
  }
}
.wizard .actions > ul {
  list-style: none;
  padding-left: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: end;
  justify-content: flex-end;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 15px;
  border-bottom: 1px solid #f5f5f4;
}
.wizard .actions li a {
  display: inline-block;
  border-radius: 6px;
  background-color: #00d69f;
  padding: 16px 30px;
  color: #fff;
  font-style: 15px;
  font-weight: bold;
}
.wizard .actions li.disabled {
  display: none;
}
.wizard .actions li:not(.disabled) + li,
.wizard .actions li:not(:first-child):last-child {
  margin-left: 15px;
}

config.css:

ul {
  list-style-type: none;
}

li {
  display: inline-block;
}

input[type="radio"][id^="cb"] {
  display: none;
}

label {
  padding: 10px;
  display: block;
  position: relative;
  margin: 10px;
  cursor: pointer;
}

label:before {
  background-color: white;
  color: white;
  content: " ";
  display: block;
  border-radius: 50%;
  border: 1px solid grey;
  position: absolute;
  bottom: 0px;
  width: 25px;
  height: 25px;
  text-align: center;
  line-height: 28px;
  transition-duration: 0.4s;
  transform: scale(0);
}

label img {
  height: 150px;
  width: 150px;
  transition-duration: 0.2s;
  transform-origin: 50% 50%;
}

:checked + label {
  border-color: #ddd;
}

:checked + label:before {
  content: "✓";
  background-color: #4caf50;
  transform: scale(1);
}

:checked + label img {
  transform: scale(0.9);
  box-shadow: 0 0 5px #4caf50;
  z-index: -1;
}

select {
  color: black;
}

The bd-wizard.js contains the initialization of the Steps plugin:

//Wizard Init
$("#wizard").steps({
    headerTag: "h3",
    bodyTag: "section",
    transitionEffect: "none",
    titleTemplate: '#title#',

    labels: {
        next: "Weiter",
        previous: "Zurück"
    }
});

Html:

<body>
  <main class="my-5">
    <form name="contact" id="contact" action="submit.php" method="POST">
      <div class="container">
        <div id="wizard">
          ...
          <h3>
            <div class="media">
              <div class="media-body">
                <div class="bd-wizard-step-title">Gr&ouml;&szlig;e</div>
                <div class="bd-wizard-step-subtitle">Schritt 4</div>
              </div>
            </div>
          </h3>
          <section>
            <div class="content-wrapper">
              <h4 class="section-heading">
                Wie viel Wohn- und Grundst&uuml;cksfl&auml;che hat Ihre
                Immobilie?
              </h4>
              <div class="container">
                <div class="form-row">
                  <div class="form-group col-sm-12">
                    <span class="control-label">Wohnfl&auml;che</span>
                    <select class="form-control" name="living_size">
                      <option disabled selected>Bitte auswählen</option>
                      <option value="test">unter 200 &#13217;</option>
                      <option value="test2">200 - 400 &#13217;</option>
                      <option value="test3">&uuml;ber 400 &#13217;</option>
                      <option value="test4">Kann ich nicht genau sagen</option>
                    </select>
                  </div>
                  <div class="form-group col-sm-12">
                    <span class="control-label">
                      Grundst&uuml;cksfl&auml;che
                    </span>
                    <select class="form-control" name="property_size">
                      <option disabled selected>Bitte auswählen</option>
                      <option>unter 300 &#13217;</option>
                      <option>300 - 1.000 &#13217;</option>
                      <option>&uuml;ber 1.000 &#13217;</option>
                      <option>Kann ich nicht genau sagen</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
          </section>
          ...
        </div>
      </div>
    </form>
<!-- This select works as expected -->
    <span class="control-label">Wohnfl&auml;che</span>
    <select class="form-control" name="living_size">
      <option disabled selected>Bitte auswählen</option>
      <option value="test">unter 200 &#13217;</option>
      <option value="test2">200 - 400 &#13217;</option>
      <option value="test3">&uuml;ber 400 &#13217;</option>
      <option value="test4">Kann ich nicht genau sagen</option>
    </select>
  </main>
...
</body>
Darkice997
  • 13
  • 3