How can I align the search button to be next to the search box?
Code is
<div class="form-group">
<label class="col-lg-2 control-label" for="inputLoginSearch">Search for HOA</label>
<div class="col-lg-10">
<div class="input-group">
<input id="inputLoginSearch" class="form-control" type="text" placeholder="Enter search phrase">
<span class="input-group-btn">
<button class="btn btn-info" type="button">Search</button>
</span>
</div>
</div>
</div>
Edit - added full markup of page
<div id="mainDiv" runat="server" class="panel-body">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">Standard Login</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
<%-- Start of Standard Login--%>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div id="StandardLoginForm" role="form" class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="col-lg-2 control-label" for="inputLoginSearch">Search for HOA</label>
<div class="col-lg-10">
<div class="input-group">
<input id="inputLoginSearch" class="form-control" type="text" placeholder="Enter search phrase">
<span class="input-group-btn" >
<button class="btn btn-info" type="button">Search</button>
</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label" for="select">HOA</label>
<div class="col-lg-10">
<select class="form-control" id="select">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label" for="inputUserName">User Name</label>
<div class="col-lg-10">
<input class="form-control" id="inputUserName" type="text" placeholder="User Name">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label" for="inputPassword">Password</label>
<div class="col-lg-10">
<input class="form-control" id="inputPassword" type="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button class="btn btn-primary" type="submit">Login</button>
</div>
</div>
</fieldset>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<%--End of Standard Login--%>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">HOA Manager Integrated Login</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<%-- Start of Standard Login--%>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
<%--End of Standard Login--%>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
If I create a brand new 'out of the box' WebForms project in VS2013 the same thing happens. Also form-vertical makes a complete mess of everything, only form-horizontal works.
DavidG was right about the issue - the problem was removing the max-width for inputs made them spread right across the entire page - so the workaround I found was to leave the max-width in, and just change the input-group div to a max-width (allowing for the button) and then setting in the input at width:100%;
This seems to work well.
<div class="form-group form-group-sm">
<label class="col-lg-2 control-label" for="inputLoginSearch">Search for HOA</label>
<div class="col-lg-10">
<div class="input-group" style="max-width: 358px;">
<input id="inputLoginSearch" runat="server" class="form-control" type="text" placeholder="Enter search phrase" style="width: 100%;"/>
<span class="input-group-btn">
<button id="SearchButton" runat="server" class="btn btn-info" type="button">Search</button>
</span>
</div>
</div>
</div>
Related
I'm working on asp.net with bootstrap design.
I had implemented the modal pop-up on button click.
Unfortunately I'm facing the grey color over my pop-up and without any functionality working. If I click any where the modal pop-up is closing bu the grey color is always appearing until I do refresh.
My code :
<div class="table-responsive">
<table id="Table1" class="table">
<thead>
<tr>
<th>Type</th>
<th>Price</th>
<th>View</th>
<th>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">Take Appointment</button>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
Modal pop-up :
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Appointment Details</h4>
</div>
<div class="modal-body">
<div class="row text-center">
<div class="col-sm-3 col-xs-3">
<div class="form-group">
<label class="control-label">Type Name:</label>
</div>
</div>
<div class="col-sm-6 col-xs-6">
<div class="input-group">
<asp:TextBox ID="txtName" runat="server" placeholder="Enter Type Name" class="form-control"></asp:TextBox>
</div>
</div>
</div>
<div class="row text-center">
<div class="col-sm-3 col-xs-3">
<div class="form-group">
<label class="control-label">Price:</label>
</div>
</div>
<div class="col-sm-6 col-xs-6">
<div class="input-group">
<asp:TextBox ID="TextBox1" runat="server" placeholder="Enter Price" class="form-control"></asp:TextBox>
</div>
</div>
<div class="col-sm-3 col-xs-3">
</div>
</div>
<div class="input-group col-md-12 input-append" data-date-format="dd/mm/yyyy" id="divDateOfBirth">
<input class="date-picker form-control Datevalidate hasDatepicker" data-val="true" data-val-regex="Please enter valid value" data-val-regex-pattern="^(?:(?:31(\/)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{4})$" data-val-required="Please enter valid value" id="txtRESIDENT_SINCE" maxlength="10" name="RESIDENT_SINCE" onkeypress="return isDate(event)" placeholder="dd/mm/yyyy" type="text" value="" autocomplete="off">
<!--<input id="date-picker-2" type="text" class="date-picker form-control">-->
<span class="input-group-addon">
<span class="glyphicon glyphicon-remove" id="residentHideCal" onclick="clearCal(this)"></span>
</span><span id="SpanDob1" class="input-group-addon showdp">
<span class="glyphicon glyphicon-calendar" id="residentShowCal" onclick="showCal(this)"></span>
</span>
</div>
<div class="clockpicker">
<div class="input-group clockpicker">
<input type="text" class="form-control" value="09:30">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
<script type="text/javascript">
$('.clockpicker').clockpicker();
</script>
</div>
</div>
<div class="modal-footer">
<button runat="server" class="btn btn-primary btn-sm" data-dismiss="modal">Submit</button>
<button type="button" class="btn btn-default btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
My current result :
I have a form with 3 fields, two of them are for entering dates. I was requested to add an icon to the very end of the field.
This is the result:
If you see the field that has the icon expands beyonds the other fields to the left and right so it looks pretty ugly.
This is the code:
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="input-group col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button>
</div>
</div>
</div>
Any clue on how to do it right?
Here is your fixed code please copy it and paste it
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="col-md-8">
<div class="input-group ">
<input type="text" class="form-control" placeholder="mm/dd/yyyy">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div></div>
</div><div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button></div></div></div>
I have tested it works fine. Cheers!
Some CSS is messing with you.
Your line with input-group col-md-8 is apparently malfunctioning.
I made an example:
https://plnkr.co/edit/gxpaP4wR8cZzb3E4CvtR
Check if you have some custom CSS that is overriding bootstraps'.
Use my code this is working fine.
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">Begin</label>
<div class="col-md-8">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">End</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" placeholder="mm/dd/yyyy" />
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Text Search</label>
<div class="col-md-5">
<input type="text" class="form-control">
</div>
<div class="col-md-3">
<button id="btnSavedMessages" class="btn btn-primary">Search</button>
</div>
</div>
</div>
I have created an ASP.NET user input form using Bootstrap with the following HTML fragment:
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<asp:UpdatePanel ID="updSignIn" runat="server">
<ContentTemplate>
<div class="panel panel-default">
<div class="panel-heading">
Set Up Your Member Account
</div>
<div class="panel-body">
<div class="form-horizontal" role="form">
<div class="form-group">
<label for="ddSalutation" class="col-sm-4 control-label">
How Do We Greet You?
</label>
<div class="col-sm-2">
<asp:DropDownList ID="ddSalutation" runat="server" CssClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="tbFirstName" class="col-sm-4 control-label">
First Name:
</label>
<div class="col-sm-5">
<input type="text" runat="server" class="form-control" id="tbFirstName"
required placeholder="Enter your first name">
</div>
</div>
<div class="form-group">
<label for="tbMiddleName" class="col-sm-4 control-label">
Middle Name/Initial:
</label>
<div class="col-sm-5">
<input type="text" runat="server" class="form-control" id="tbMiddleName"
required placeholder="Enter your middle name/initial">
</div>
</div>
<div class="form-group">
<label for="tbLastName" class="col-sm-4 control-label">
Last Name:
</label>
<div class="col-sm-5">
<input type="text" runat="server" class="form-control" id="tbLastName"
required placeholder="Enter your last name">
</div>
</div>
<div class="form-group">
<label for="tbPhone" class="col-sm-4 control-label">
Contact Telephone:
</label>
<div class="col-sm-3">
<input type="tel" title="Telephone Number" pattern="^\d{3}-\d{3}-\d{4}$"
id="tbPhone" placeholder="Telephone" class="form-control"
required runat="server" />
</div>
</div>
<div class="form-group">
<label for="tbSSN" class="col-sm-4 control-label">
SSN/Tax ID Number:
</label>
<div class="col-sm-3">
<input type="text" pattern="^\d{3}-\d{2}-\d{4}$"
title="Social Security Number" runat="server" class="form-control" id="tbSSN"
required placeholder="SSN/Tax ID">
</div>
</div>
<div class="spacer"> </div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-7" id="buttons">
<asp:Button ID="btnNext" runat="Server"
Text="Next"
CssClass="btn btn-default btn-sm col-sm-4"
OnClick="btnNext_Click"></asp:Button>
<button type="reset" id="btnReset" class="btn btn-default btn-sm col-sm-4">
Reset Form</button>
</div>
</div>
<div class="row">
<div class="spacer"> </div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="text-center" id="divProcessing" style="display: none;">
<img src="images\loading.gif" style="height: 40px; width: 40px;" /> Please wait...
</div>
<div class="row">
<div class="alert alert-danger fade col-sm-offset-1 col-sm-10 text-center" id="lblStatus"> </div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
The form lays out just fine. The problem is, when I click the button to process the form, the validation messages from Bootstrap don't line up with the fields that need attention from the user. Here's a screenshot of what happens:
As you can see, the form field that needs attention is the first name field, but the tooltip popup from Bootstrap is down to the lower right. I don't have any malformed HTML, so I don't understand what the problem is with the positioning of the popup message. Any help on this? Thanks!
Consider the following:
I have 2 buttons a Login btn and a Registration Button. When either one of the buttons are clicked a bootstrap modal comes up, with 2 tabs, one for login and one for registration.
My Problem
Regardless if login button or registration button is clicked the modal always opens on the login tab, if user clicks register button I would like the modal to open on the registration tab.
JSFIDDLE LINK, CLICK HERE
Here is a visual example:
Two Buttons, user clicks button Bootstrap Modal Opens
Bootstrap Modal opens on login tab, section
If user clicks Register Button the Modal still opens on the login tab section, I would like this to change, so modal opens on registration tab when register button is clicked
Code Buttons:
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-62 col-xs-6">
<button type="button" data-toggle="modal" data-target="#myModal" style="cursor:pointer" id="loginBtn">Login</button>
</div><!--Columns-->
<div class="col-lg-6 col-md-6 col-sm-62 col-xs-6">
<!-- I BELIEVE THE PROBLEM IS HERE-->
<button type="button" data-toggle="modal" data-target="#myModal#registration" style="cursor:pointer" id="regBtn">Register</button>
</div><!--Columns-->
</div><!--Row-->
Modal Code
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h4 class="modal-title" id="myModalLabel">
Login/Registration
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8" style="border-right: 1px dotted #C2C2C2;padding-right: 30px;">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active">Login</li>
<li>Registration</li>
</ul>
<!-- Tab panes -->
<!--LOGIN TAB -->
<div class="tab-content">
<div class="tab-pane active" id="Login">
<form class="form-horizontal" role="form" method="post" id="tabLogin" action="includes/loginScript.php">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<span id="email-info"></span>
<div class="col-sm-10">
<input type="email" name="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<span id="pwd-info"></span>
<div class="col-sm-10">
<input type="password" name="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
<!-- <span style="color:red;">Forgot Password</span>-->
</form>
<div id="tabloginMsg"></div>
<!--**********END LOGIN TAB*************** -->
</div>
<!--*************START REGISTRATION************************* -->
<div class="tab-pane" id="Registration">
<form name="regForm" class="form-horizontal" role="form" id="regTab" action="includes/classes/class.userRegistration.php" method="post">
<div class="form-group">
<label class="control-label col-sm-2" for="regName">Name:</label>
<div class="col-sm-10">
<input type="text" name="userName" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regLastName">Surname:</label>
<div class="col-sm-10">
<input type="text" name="userSurname" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regEmail">Email:</label>
<div class="col-sm-10">
<input type="email" name="userEmail" required class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regPword">Password:</label>
<div class="col-sm-10">
<input type="password" name="pword1" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="confRegPword">Confirm Password:</label>
<div class="col-sm-10">
<input type="password" name="pword2" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="regPhone">Phone:</label>
<div class="col-sm-10">
<input type="text" name="userPhone" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<button name="submit" class="btn btn-danger" style="font-size:19px" >Register</button>
</div>
</div>
</form>
<div id="tabregMsg"></div>
</div>
</div>
<div id="OR" class="hidden-xs">
OR</div>
</div>
<div class="col-md-4">
<div class="row text-center sign-with">
<div class="col-md-12">
<h4>
Sign in with</h4>
</div>
<div class="col-md-12">
<div class="btn-group btn-group-justified">
Facebook
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
You can use jquery to get this approach
simply change your css code for TAB to
<ul class="nav nav-tabs">
<li id="loginLi">Login</li>
<li id="RegLi">Registration</li>
</ul>
then add this jQuery click action :
$("#loginBtn").on('click',function(){
$('#RegLi').removeClass('active');
$('#loginLi').addClass('active');
})
$("#regBtn").on('click',function(){
$('#loginLi').removeClass('active');
$('#RegLi').addClass('active');
})
you may improve this code but it's the idea to select the proper tabs.
see the demo here : https://jsfiddle.net/j4pkru1a/
What am I missing?
I can see the border of the container and it correctly shows the area that I have to work with.
However when I add the row (div) and offset(div) it is left justifying it.
<div id="page" class="container" style="border:solid">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group">
<label for="firstName">First Name:</label>
<input type="text" id="firstName" class="form-control" />
</div>
<div class="form-group">
<label for="lastName">Last Name:</label>
<input type="text" id="lastName" class="form-control" />
</div>
</div>
</div>
</div>
I think I know what you are meaning, but I'm not sure. Do you mean like this?
If so, the class for that is:
class="text-center"
So you can change your code to this:
<div id="page" class="container" style="border:solid">
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<div class="form-group">
<label for="firstName">First Name:</label>
<input id="firstName" class="form-control text-center" type="text">
</div>
<div class="form-group">
<label for="lastName">Last Name:</label>
<input id="lastName" class="form-control text-center" type="text">
</div>
</div>
</div>
Or you can add it to just the controls you want, for example just the input form controls.
Hope that helps!
Bootstrap can provide a great mobile experience, but desktops can also benefit from its scaffolding capabilities. So, when I develop forms I like to use the least amount of space possible. With that in mind I have improved on Demonic Penguin's code and your, as well. Like so:
<div id="page" class="container" style="border:solid">
<div class="row" style="padding-top: 12px;"></div>
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<div class="form-group">
<input id="firstName" class="form-control text-center" placeholder="First Name" type="text">
</div>
<div class="form-group">
<input id="lastName" class="form-control text-center" placeholder="Last Name" type="text">
</div>
</div>
</div>
</div>
You can also embellish your form by adding icons to the fields, like so:
<div id="page" class="container" style="border:solid">
<div class="row" style="padding-top: 12px;"></div>
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="firstName-addon"><i class="fa fa-user"></i></span>
<input id="firstName" class="form-control text-center" placeholder="First Name" type="text">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="lastName-addon"><i class="fa fa-user"></i></span>
<input id="lastName" class="form-control text-center" placeholder="Last Name" type="text">
</div>
</div>
</div>
</div>
</div>
For this implementation, you must add a FontAwesome CSS reference link to your page(s) that you can get from here: https://www.bootstrapcdn.com/fontawesome/