Bootstrap 2 grid issue for sidebar widget - html

I'm trying to get the label and input and icon all on the same row in a sidebar widget area. this is what it should look like (edit: not sure why but image shows in chrome but not FF on SO)
This is what I have so far. I can't seem to get the labels and inputs on the save row. they keep wrapping around.
Here's a fiddle
http://jsfiddle.net/#&togetherjs=p6omqsAoyN
Here's the HTML. Can anyone tell me how to get them all on the same row so that it looks like the image above?
<div class="roster-reports module">
<h3>Reports</h3>
<div class="upper" >
<h5 class="strong">Generate Report</h5>
<ul class="row-fluid stat-pending">
<li class="span4">
<label for="inputReportFromDate" class="control-label">From Date</label>
</li>
<li class="span4">
<input type="date" class="form-control" width="2" id="inputReportFromDate">
</li>
<li class="span4">
<i class=" icon-calendar"></i>
</li>
</ul>
<div class="">
<div class="">
<label for="inputReportToDate" class="control-label">To Date</label>
</div>
<div class="">
<input type="date" class="form-control" id="inputReportToDate">
<i class="icon-calendar"></i>
</div>
</div>
<div class="">
<div class="">
<label for="selectReportType" class="control-label">Report Type</label>
</div>
<div class="">
<select id="inputReportType" class="form-control">
<option value="Query History">Query History</option>
<option value="DAS Alerts">DAS Alerts</option>
</select>
</div>
</div>
<div class="">
<div class="">
<label for="selectReportType" class="col-lg-2 control-label">Report Format</label>
</div>
<div class="">
<select id="selectReportFormat" class="form-control">
<option value="PDF">PDF</option>
<option value="CSV">CSV</option>
<option value="XLXS">XLXS</option>
</select>
</div>
</div>
<div class="">
<div class="">
<button id="buttonRosterReportsGenerate" type="submit" class="btn btn-primary">Generate</button>
</div>
</div>
</div>
</div>

I am not sure what you mean exactly by "sidebar widget area", but the common way to achieve what you want in bootstrap is using .form-group elements inside a .form-horizontal <form>. Modified markup :
<div class="roster-reports module">
<h3>Reports</h3>
<div class="upper">
<form class="form-horizontal" role="form">
<div class="form-group">
<h5 class="strong">Generate Report</h5>
</div>
<div class="form-group">
<label for="inputReportFromDate" class="control-label">From Date</label>
<input class="form-control" id="inputReportFromDate" type="date" width="2"/>
<i class=" icon-calendar"></i>
</div>
<div class="form-group">
<label for="inputReportToDate" class="control-label">To Date</label>
<input class="form-control" id="inputReportToDate" type="date"/>
<i class=" icon-calendar"></i>
</div>
<div class="form-group">
<label for="selectReportType" class="control-label">Report Type</label>
<select class="form-control" id="inputReportType">
<option value="Query History">Query History</option>
<option value="DAS Alerts">DAS Alerts</option>
</select>
</div>
<div class="form-group">
<label for="selectReportType" class="control-label">Report Format</label>
<select class="form-control" id="selectReportFormat">
<option value="PDF">PDF</option>
<option value="CSV">CSV</option>
<option value="XLXS">XLXS</option>
</select>
</div>
<div class="form-group">
<label class="control-label"></label>
<button class="btn btn-primary" id="buttonRosterReportsGenerate" type="submit">Generate</button>
</div>
</form>
</div>
</div>
see fiddle -> http://jsfiddle.net/h159f8nw/
As I wrote, I am not sure how you want to use this, the fiddle does not completely fulfill the position of "Generate Report" as in the image, but .form-group and .form-horizontal is defently the way to go.

Related

How to align in HTML in forms

This is my code I'm using, can anyone tell me how can I align my caterer and the dropdown menu. I got 5 screens some of them I manage to align but in this screen, I have no idea of how to do it.
<div class="row ">
<div class="col-md-12">
<div class="card m-b-30">
<div class="card-header">
<h5 class="card-title">RESERVATION COMPLETION</h5>
</div>
<div class="card-body">
<form id="form" enctype="multipart/form-data">
<input type="hidden" id="Id" />
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="Category">Caterer</label>
<select class="form-control js-example-basic-single" id="data-packagetypes-caterercombo" style="width:200px;">
<option value="">Golden Crown</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="ReservationNo">Reservation No</label>
<select class="form-control js-example-basic-single" id="data-reservationcompletion-combo" style="width:200px;" required>
<option value="">--Select--</option>
</select>
</div>
</div>
</div>
<button type="submit" id="btnSubmit" class="btn btn-dark">Complete Reservation</button>
<button type="reset" id="btnClear" class="btn btn-dark">Clear</button>
</form>
</div>
</div>
</div>
</div>
In First Line Of code div class="row ". you Can Add align="center" Like This
<div class="row " align="center">
See Example

Twitter Bootstrap 3 Checkbox Won't Align with rest of Form

I'm having some trouble with a Twitter Bootstrap form alignment. I have a checkbox that causes the below div's to incorrectly line up with the grid because it's height is only 70px tall when the div next to it is 74px. I could add the CSS to force it to the pixel height needed (see id "test") but I don't want this stay a fixed height when content responds for smaller screens. What would be the best way to fix this?
<div class="container-fluid appointment">
<div class="container">
<div class="row">
<h2 class="text-center">Appointment Request</h2>
<form>
<div class="col-sm-4">
<div class="form-group">
<label for="">Phone Number:</label>
<input type="tel" class="form-control" id="phone">
</div>
</div>
<div class="col-sm-8">
<div class="form-group">
<label for="email">Email Address:</label>
<input type="email" class="form-control" id="email">
</div>
</div>
<div class="col-sm-7">
<div class="form-group">
<label for="petname">Pet's Name:</label>
<input type="text" class="form-control" id="petname">
</div>
</div>
<div class="col-sm-5" id="test">
<div class="form-group">
<label>Is your pet neutered or spayed?</label>
<div class="checkbox">
<label for="neutered"><input type="checkbox" id="neutspay">Neutered/Spayed</label>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="pettype">Pet Type:</label>
<select class="form-control" id="pettype">
<option>Select Pet Type...</option>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="breed">Breed Type:</label>
<select class="form-control" id="breed">
<option>Select Breed...</option>
</select>
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
<label for="age">Pet Age:</label>
<select class="form-control" id="age">
<option>Select Pet Age...</option>
<option value="less than 1">Less than 1 year</option>
<option value="1">1 Year</option>
</select>
</div>
</div>
<div class="col-sm-12 text-center">
<div class="form-group">
<button type="submit" class="btn btn-lg">Send Appointment</button>
</div>
</div>
</form>
</div>
</div>
</div>
just add a class "clearfix" for the div containing the checkbox as
<div class="col-sm-5" id="test">
<div class="form-group clearfix">
<label>Is your pet neutered or spayed?</label>
<div class="checkbox">
<label for="neutered"><input type="checkbox" id="neutspay">Neutered/Spayed</label>
</div>
</div>
</div>

How to maintain the width after adding icon next to dropdown list

Based on my code, is there any way to make the dropdown list align with the other input fields?
I need to add an icon right next to the dropdown list. However, class="form-control" should be 100% width by default but it doesn't after I added the icon.
<form asp-action="Apply" asp-controller="Jobs">
<div class="form-horizontal">
<div class="form-group">
<label asp-for="Name" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Name" class="form-control" />
</div>
</div>
<div class="form-group">
<label asp-for="YearsAttended" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="YearsAttended" class="form-control" min="0" value="0"/>
</div>
</div>
<div class="form-group">
<label asp-for="HighestQualification" class="col-md-2 control-label"></label>
<div class="col-md-10 form-inline">
<select asp-for="HighestQualification" asp-items="Html.GetEnumSelectList<QualificationLevel>()" class="form-control">
<option value="">Choose one...</option>
</select>
help</i>
</div>
</div>
</div>
</form>
You're probably best making use of Input Groups provided by bootstrap.
HTML
<div class="form-group">
<label asp-for="HighestQualification" class="col-md-2 control-label"></label>
<div class="col-md-10">
<div class="form-inline input-group">
<select asp-for="HighestQualification" asp-items="Html.GetEnumSelectList<QualificationLevel>()" class="form-control">
<option value="">Choose one...</option>
</select>
<span class="input-group-addon">
<a href='#' >
<i class="material-icons" style="vertical-align: middle;">help</i>
</a>
</span>
</div>
</div>
</div>
Then adjust the input-group-addon styling to remove the "grey" that comes default
CSS
.input-group-addon {
padding: 0 6px;
color: inherit;
background-color: transparent;
border: none;
}
JSFIDDLE

bootstrap3 form has text overlapping with dropdown

I am trying to create a form that looks like this:
What I have come up with looks like this. I either can have the dropdown take up the correct amount of space, but then the text is underneath, or have the text next to the dropdown and everything gets smushed.
I'm not sure what I'm doing wrong. Here is the html:
<form class="schedulerBody form-horizontal" id="{{sourceCleaned}}">
<div class="form-group">
<label class="col-sm-3 control-label">{{t "templates.scheduler.fireEvery"}}</label>
<div class="col-sm-8">
<div class="form-inline">
<div class="form-group">
<select class="liveSyncSchedule form-control"></select>
</div>
<div class="form-group">{{t "templates.scheduler.seconds"}}</div>
</div>
</div>
<div class="col-sm-offset-3 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox" />{{t "templates.scheduler.enabled"}}
</label>
</div>
</div>
<div class="col-sm-offset-3 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox" />{{t "templates.scheduler.persisted"}}
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{{t "templates.scheduler.misfirePolicy"}}</label>
<div class="col-sm-8">
<select class="misfirePolicy form-control">
<option value="fireAndProceed">{{t "templates.scheduler.fireAndProceed"}}</option>
<option value="doNothing" selected>{{t "templates.scheduler.doNothing"}}</option>
</select>
</div>
</div>
All help is greatly appreciated!
The layout is messed because form-group class is not handled properly. Try this,
<form class="schedulerBody form-horizontal" id="{{sourceCleaned}}">
<div class="form-group">
<label class="col-sm-3 control-label">{{t "templates.scheduler.fireEvery"}}</label>
<div class="col-sm-8">
<div class="form-inline">
<select class="liveSyncSchedule form-control"></select>
<span>{{t "templates.scheduler.seconds"}}</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox" />{{t "templates.scheduler.enabled"}}
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<div class="checkbox">
<label>
<input type="checkbox" />{{t "templates.scheduler.persisted"}}
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{{t "templates.scheduler.misfirePolicy"}}</label>
<div class="col-sm-8">
<select class="misfirePolicy form-control">
<option value="fireAndProceed">{{t "templates.scheduler.fireAndProceed"}}</option>
<option value="doNothing" selected>{{t "templates.scheduler.doNothing"}}</option>
</select>
</div>
</div>
</form>
Thanks!
Here is a simplified fiddle: https://jsfiddle.net/mz1xgr38/
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Fire every</label>
<div class="col-sm-9">
<div class="row">
<div class="col-md-6">
<select class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>
<div class="col-md-6">
Seconds
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9 ">
<div class="checkbox">
<label>
<input type="checkbox" />Enabled
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" />Persisted
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Misfire policy</label>
<div class="col-sm-9">
<select class="form-control">
<option>Option 1</option>
<option>Option 2</option>
</select>
</div>
</div>
</form>

Bootstrap 3: multiple select in input-group overlap

I have a problem joining multiple select tags into .input-group.
Here is my code:
<form class="form-horizontal" role="form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6" >Label 1</label>
<div class="col-md-6">
<select class="form-control">
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6" >Label 2</label>
<div class="col-md-6">
<select class="form-control" >
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6">Label 3</label>
<div class="input-group col-md-6">
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
</div>
</div>
</div>
</div>
</form>
The problem is as follows:
In the last form-group, after the Label 3, three span's with select inside them have higher width then they should have and they overlap to the right and left of their input-group container (about 15 px).
Here is jsfiddle demostrating the problem (just click on first or third select in the last row)
Made another div for using class="form-group", See DEMO on full page mode in snippet
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<form class="form-horizontal" role="form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6">Label 1</label>
<div class="col-md-6">
<select class="form-control">
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6">Label 2</label>
<div class="col-md-6">
<select class="form-control">
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6">Label 3</label>
<div class="col-md-6">
<div class="input-group ">
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
</div>
</div>
</div>
</div>
</div>
</form>
change HTML
<form class="form-horizontal container-fluid" role="form">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6" >Label 1</label>
<div class="col-md-6">
<select class="form-control">
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6" >Label 2</label>
<div class="col-md-6">
<select class="form-control" >
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-6">Label 3</label>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" aria-label="Checkbox for following text input">
</span>
<select class="form-control">
</select>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" aria-label="Checkbox for following text input">
</span>
<select class="form-control">
</select>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" aria-label="Checkbox for following text input">
</span>
<select class="form-control">
</select>
</div>
</div>
</div>
</div>
</form>
https://jsfiddle.net/qrtcq8bs/4/
just add
the margin-left:0; & margin-right:0;
in the form-group
because by default is negative
<div class="form-group" style="margin-left:0 !important; margin-right:0 !important;">
<label class="control-label col-md-6">Label 3</label>
<div class="input-group col-md-6">
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
<span class="input-group-btn">
<select class="form-control">
</select>
</span>
</div>
</div>