3
votes

I would like to group the radio button and bootstrap select but they're not inline.

<div class="container">
            <form class="form-inline">
            <div class="input-group">
            <label class="radio-inline">
              <input name="radioGroup" id="radio1" value="option1" type="radio"><span class="input-group-addon"> Preset Size (<b>inch</b>): 
            </span></label>
              <div class="col-md-6">
              <select id="size" class="selectpicker form-control" data-live-search="true" title="Please select preset size ...">
                    <option>36” x 84”</option>
                    <option>48”x84”</option>
                    <option>60”x84”</option>
                    <option>72x84”</option>
                    <option>48”x96”</option>
                </select>
              </div>
            </div> <!-- Radio + Dropdown -->
            </form>
            </div> <!-- container -->

and I also want to group 2 text boxes together with the label to create user input.

<div class="container">
            <form class="form-inline">
            <div class="input-group">
            <label class="radio-inline">
              <input name="radioGroup" id="radio2" value="option2" checked="" type="radio"> Custom Size: 
            </label>
            <div class="col-sm-4">
              <input type="text" class="form-control" id="customSize1" placeholder="">
            </div>
            <div class="col-sm-4">
              <label> x </label>
             </div> 
            <div class="col-sm-4">
              <input type="text" class="form-control" id="customSize2" placeholder="">
            </div>
            </div>
          </form>
          </div>

Here's the output screenshot.

enter image description here

3
It's not clear as to what you are trying to do. Your second section of code says you want to join to text boxes but there's a radio button in-between them. Are you trying to put all of that in a input group or just inline?vanburen
inline with the radio buttons.user3744076
It seems like you are using .input-group and not .form-group for your inline forms... did you try this HMTL first? getbootstrap.com/css/#forms-inlineblurfus

3 Answers

2
votes

You may need to re-arrange your code a bit to fit bootstrap's use.

Firstly, use .form-group - also put element in rows when possible.

Something along the lines of:

ps you may have to adjust this a bit but it should give you a good place to start from

.form-inline input.form-control {
  width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />


<div class="container">
  <form class="form-inline">
    <div class="row">
      <div class="form-group col-xs-6">
        <label class="radio-inline col-xs-6">
          <input name="radioGroup" id="radio1" value="option1" type="radio" />Preset Size (<b>inch</b>):
        </label>
        <div class="col-xs-5">
          <select id="size" class="selectpicker form-control" data-live-search="true" title="Please select preset size ...">
            <option>36”x84”</option>
            <option>48”x84”</option>
            <option>60”x84”</option>
            <option>72x84”</option>
            <option>48”x96”</option>
          </select>
        </div>

      </div>
      <div class="form-group col-xs-6">
        <label class="radio-inline col-xs-5">
          <input name="radioGroup" id="radio2" value="option2" checked="" type="radio">Custom Size:
        </label>
        <div class="col-xs-3">
          <input type="text" class="form-control" id="customSize1" placeholder="">
        </div>
        <div class="col-xs-1">
          <label>x</label>
        </div>
        <div class="col-xs-3">
          <input type="text" class="form-control" id="customSize2" placeholder="">
        </div>
      </div>

    </div>
  </form>
</div>
0
votes

You forgot the row div. whenever you are using bootstrap layout with columns- you need to nest the columns div inside a row div:

<div class="row">
  <div class="col-sm-4"> first third</div>
  <div class="col-sm-4"> second third</div>
  <div class="col-sm-4"> third third</div>
</div>

Read the bootstrap doc for more information

0
votes

Here are two ways you can do this depending on if you want all the elements in one row or not. It's just utilizing input-groups and not much else.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<hr>
<form>
  <div class="container">
    <div class="row">
      <div class="col-xs-12">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon">
        <input type="radio" aria-label="..."> Preset Size (<b>inch</b>):
      </span>

            <select id="size" class="selectpicker form-control" data-live-search="true" title="Please select preset size ...">
              <option>36” x 84”</option>
              <option>48”x84”</option>
              <option>60”x84”</option>
              <option>72x84”</option>
              <option>48”x96”</option>
            </select>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-6">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon">
        <input name="radioGroup" id="radio2" value="option2" checked="" type="radio"> Custom Size:
      </span>

            <input type="text" class="form-control" id="customSize1" placeholder="">
          </div>
        </div>
      </div>
      <div class="col-xs-6">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon" id="sizing-addon2">X</span>

            <input type="text" class="form-control" id="customSize2" placeholder="">
          </div>
        </div>
      </div>
    </div>
  </div>
</form>
<hr>
<form>
  <div class="container">
    <div class="row">
      <div class="col-xs-5">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon">
        <input type="radio" aria-label="..."> Preset Size (<b>inch</b>):
      </span>

            <select id="size" class="selectpicker form-control" data-live-search="true" title="Please select preset size ...">
              <option>36” x 84”</option>
              <option>48”x84”</option>
              <option>60”x84”</option>
              <option>72x84”</option>
              <option>48”x96”</option>
            </select>
          </div>
        </div>
      </div>
      <div class="col-xs-4">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon">
        <input name="radioGroup" id="radio2" value="option2" checked="" type="radio"> Custom Size:
      </span>

            <input type="text" class="form-control" id="customSize1" placeholder="">
          </div>
        </div>
      </div>
      <div class="col-xs-3">
        <div class="form-group">
          <div class="input-group"> <span class="input-group-addon" id="sizing-addon2">X</span>

            <input type="text" class="form-control" id="customSize2" placeholder="">
          </div>
        </div>
      </div>
    </div>
  </div>
</form>
<hr>