Bootstrap 3 validation status with input groups

How to add bootstrap 3 check states to input groups. The state seems to apply only to the input of the group.

EDIT 02/10/2014: To clarify, I am using an input group with a button:

<div class="form-group has-success col-md-3">
  <label class="control-label"></label>
  <div class="input-group">
    <input type="text" class="form-control">
    <span class="input-group-btn">
      <button class="btn btn-default" type="button">Go!</button>
    </span>
  </div>
</div>

http://bootply.com/112305

+3
source share
2 answers

The trick is to put the actual input in your own block. Try the following:

<div class="form-group has-feedback">
    <div class="input-group">
        <div style="position:relative"><!-- sub container for the input and validation state -->
            <input name="emailAddress" type="text" class="form-control" value="">
            <span class="glyphicon glyphicon-remove form-control-feedback"><!----></span>
        </div>
        <span class="input-group-btn">
            <button id="button-send" type="submit" class="btn btn-primary">Go!</button>
        </span>
    </div>
</div>
+5
source

Wrap it inside form-groupand apply the validation state class to the form group.

<div class="form-group has-success col-md-3">
  <label class="control-label"></label>
  <div class="input-group">
    <input type="text" class="form-control">
    <span class="input-group-addon">00</span>
  </div>
</div>

http://bootply.com/111979

0
source

All Articles