1000hz / bootstrap-validator

A user-friendly HTML5 form validation jQuery plugin for Bootstrap 3
http://1000hz.github.io/bootstrap-validator
MIT License
2.38k stars 1.07k forks source link

Doesn't work with inputs nested inside .form-group > .input-group. #577

Open trusktr opened 7 years ago

trusktr commented 7 years ago

I'm using Bootstrap 4 alpha.

When I have something like the following, it works fine:

<form role="form" data-toggle="validator">

  <div class="form-group">
    <label class="font-weight-bold">Password</label>
    <input
      type="password"
      class="form-control"
      name="password"
      id="password"
      data-minlength="6"
      required
    >
    <small class="help-block">Minimum of 6 characters</small>
  </div>

</form>

But when I move the input into a .input-group, there is no longer any validation, it just stops working:

<form role="form" data-toggle="validator">

  <div class="form-group">
    <label class="font-weight-bold">Password</label>
    <div class="input-group" component="showHidePassword">
      <input
        type="password"
        class="form-control"
        name="password"
        id="password"
        data-minlength="6"
        required
      >
      <span class="input-group-btn" v-on:click="clickShowHide">
        <button class="btn btn-secondary" type="button">
          <span v-show="hidden">Show</span>
          <span v-show="!hidden">Hide</span>
        </button>
      </span>
    </div>
    <small class="help-block">Minimum of 6 characters</small>
  </div>

</form>
trusktr commented 7 years ago

So when there is .form-group > input it works fine, but doesn't work at all with .form-group > .input-group > input.

bomshteyn commented 7 years ago

@trusktr Were you able to find a solution?

Rhonln commented 7 years ago

I have the same problem, how did you solve it?

trusktr commented 7 years ago

I think I just re-structured my forms.​