I am trying to add button on top of the page and one form at the bottom when I click on the button it should go down at the form location on same page. I am don't know how I can do that.
here is my code for button
<div class="col-xs-12 col-sm-2">
<p style="padding:40px;"></p>
<button class="btn btn-block btn-warning">Reserve Table</button>
</div>
Here is my code of form
<div class="col-xs-6 col-sm-3">
<div class="form-vertical" role="form">
<p style="padding:10px;"></p>
<h3>Table Reservation</h3>
</div>
</div>
<div class="col-xs-6 col-sm-9">
<div class="form-horizontal" role="form">
<div class="form-group">
<label for="Number" class="col-sm-2 control-label">Number of people</label>
<label class="radio-inline">
<input type="radio" name="optradio">1
</label>
<label class="radio-inline">
<input type="radio" name="optradio">2
</label>
<label class="radio-inline">
<input type="radio" name="optradio">3
</label>
<label class="radio-inline">
<input type="radio" name="optradio">4
</label>
<label class="radio-inline">
<input type="radio" name="optradio">5
</label>
<label class="radio-inline">
<input type="radio" name="optradio">6
</label>
</div>
<div class="form-group has-feedback">
<label for="Date-time" class="col-sm-2 control-label">Date & Time</label>
<div class="col-sm-3">
<input type="text" class="form-control pull-left" name="Date-time" placeholder="date">
<i class="glyphicon glyphicon-calendar form-control-feedback"></i>
</div>
<div class="form-group has-feedback">
<div class="col-sm-3">
<input type="text" class="form-control" placeholder="time">
<i class="glyphicon glyphicon-time form-control-feedback"></i>
</div>
</div>
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
Please <strong >call</strong> for bookinng of more than 6 people.
</div>
</div>
</div>
please tell me how to do this??
Hello #lomesh shah this is easy.
Step 1
First give that form an id like
<form id="testform"> rest of the code goes here </form>
Step 2
You have to use anchor tag instead of the button but by using bootstrap's btn classes over it you can give it a button apperance and then use id of the form inside the href, click which will take you down to the form. See code below
Go to form
Confusion ? Hit me back :) I will respond
give the form id
then use this
Reserve Table</button>
Related
I am having a very strange occurrence when running this Modal as seen below:
<button type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#reserveModal">
Read more »
</button>
<div id="reserveModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<form class="form-inline" role="form" id="reservations">
<div class="form-group col-xs-12" style=" margin:10px">
<label for="guests" class="col-xs-3 control-label">
<h4>Number of Guests</h4></label>
<div class="checkbox col-xs-9" id="guests">
<label class="checkbox-inline margin:0 px">
<input type="radio" name="approve" value="">
<strong>1</strong>
</label>
<label class="checkbox-inline">
<input type="radio" name="approve" value="">
<strong>2</strong>
</label>
<label class="checkbox-inline">
<input type="radio" name="approve" value="">
<strong>3</strong>
</label>
<label class="checkbox-inline">
<input type="radio" name="approve" value="">
<strong>4</strong>
</label>
<label class="checkbox-inline">
<input type="radio" name="approve" value="">
<strong> 5 </strong>
</label>
<label class="checkbox-inline">
<input type="radio" name="approve" value="">
<strong> 6 </strong>
</label>
</div>
</div>
<div class="form-group col-xs-12" style=" margin:10px">
<label for="section" class="col-xs-3 control-label">
<h4>Section</h4></label>
<div class="section col-xs-9" id="section">
<input type="radio" name="section" value="" id="nonSmoking">
<label class="nonSmoking checkbox-inline" for="nonSmoking">
<strong>Non-Smoking</strong>
</label>
<input type="radio" name="section" value="" id="smoking">
<label class="smoking checkbox-inline" for="smoking">
<strong>Smoking</strong>
</label>
</div>
</div>
<div class="form-group col-xs-12" style=" margin:10px">
<label for="date time" class="col-xs-3 control-label text-align:right">
<h4>Date and Time</h4></label>
<div class="input-group add-on date datepicker form col-xs-3">
<input type="date" class="form-control date-picker" id="date" />
<div class="input-group-btn">
<button class="btn btn-default">
<i class="fa fa-calendar"></i>
</button>
</div>
</div>
<div class="input-group form col-xs-2 col-xs-offset-1">
<input type="time" class="form-control" id="time" placeholder="Time" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="col-xs-12" margin:10px>
<button type="submit" class="btn btn-primary col-xs-offset-3">Reserve</button>
</div>
</form>
</div>
<!-- /.modal-body -->
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
For context, I am going through a Coursera class and this is part of one of the assignments. I cannot figure out why the background does not cover the entirety of the modal - only covering the top line or so.
Here is the jsfiddle: https://jsfiddle.net/jacoblhughes/y55uyhfx/2/
Add clearfix class to <form class="form-inline" role="form" id="reservations">
Since you're using col-xs-12 on the form-group items, they're floated to the left, thus the parent form doesn't take on their height. So you need to apply the clearfix to it. If you don't know what clearfix is, I would suggest looking it up.
I want to create an inline form using bootstrap with labels above input text fields but the result looks so messed up.
This is what i tried:
<form id="form" method="post" class="form-inline" >
<div class="row">
<div class="col-md-2">
<label for="from">from:</label>
<input type="text" class="form-control form-text" />
</div>
<div class="col-md-2">
<label for="to">to:</label>
<input type="text" class="form-control form-text"/>
</div>
<div class="input-group date col-md-2" id="datepicker">
<label for="checkin">check in</label>
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
<div class="input-group date col-md-2" id="datepicker">
<label for="checkout">check out</label>
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
<div class="col-md-2">
<input type="submit" class="btn btn-default" value="submit"/>
</div>
</div>
</form>
this is what i got:
result
how do i get the submit button to right position and the glyphicons heights the same as the input fields what am i doing wrong?
I made some edits to your html : https://jsfiddle.net/05t4s041/
<form id="form" method="post" class="form-inline" >
<div class="row">
<div class="col-md-2">
<label for="from">from:</label>
<input type="text" class="form-control form-text" />
</div>
<div class="col-md-2">
<label for="to">to:</label>
<input type="text" class="form-control form-text"/>
</div>
<div class="col-md-2">
<label for="checkin">check in</label>
<div class="input-group date" id="datepicker">
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
</div>
<div class="col-md-2">
<label for="checkout">check out</label>
<div class="input-group date" id="datepicker">
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
</div>
<div class="col-md-2">
<input type="submit" class="btn btn-default" value="submit"/>
</div>
</div>
</form>
you could put divs with bootstrap classes around your label and control like:
<div class="col-md-2">
<div class="row">
<div class="col-md-6">
<label for="from">from:</label>
</div>
<div class ="col-md-6">
<input type="text" class="form-control form-text" />
</div>
</div>
</div>
The row div may be sufficient: it put's elements in a row put I like to put extra bootstrap classes around my controls so I can modify them. For example that the label has a smaller width than the control itself.
Created a form for user input by making use of Bootstrap classes. I have included the simple form inclusion for your perusal.
Issue:
1.) I am trying to place the glyphicon within the input box of the form, however the icon is placed outside. I have called the glyphicon glyohicon-date within the input tag class but the icon is placed outside of the input box. How is it possible for me to input it inside the input box?
Thanks.
<div class="row row-content">
<div class="col-xs-12 col-lg-3">
<p style="padding:20px;"></p>
<h3 align=center>Reserve A Table</h3>
</div>
<div class="col-xs-12 col-sm-9">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">Number of Guests</label>
<div class="input-group col-sm-4">
<input type="radio">
<span> 1 </span>
<input type="radio">
<span> 2 </span>
<input type="radio">
<span> 3 </span>
<input type="radio">
<span> 4 </span>
<input type="radio">
<span> 5 </span>
<input type="radio">
<span> 6 </span>
</div>
</div>
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">Date & Time</label>
<div class="col-sm-4">
<input type="text" class="form-control glyphicon glyphicon-calendar" aria-hidden="true" id="Date" name="Date" placeholder="Date"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
</div>
<div class="col-sm-4">
<input type="text" class="form-control glyphicon glyphicon-time" id="Time" name="Time" placeholder="Time">
</div>
</div>
<button type="submit" class="btn btn-default">Reserve</button>
</form>
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<strong>Warning!</strong> Please <strong>call</strong> us to reserve for more than six guests.
</div>
</div>
</div>
Have managed to solve it from the given link: With optional icons
<div class="form-group has-feedback">
<label for="firstname" class="col-sm-2 control-label">Date & Time</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="Date" name="Date" placeholder="Date">
<span class="glyphicon glyphicon-calendar form-control-feedback" aria-hidden="true"></span>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="Time" name="Time" placeholder="Time">
<span class="glyphicon glyphicon-time form-control-feedback" aria-hidden="true"></span>
</div>
</div>
<div class="form-group form-inline">
<label for="datetime" class="col-sm-2 control-label">Date and Time</label>
<div class="col-sm-5">
<div class="form-group has-feedback">
<input type="text" class="form-control" id="datetime" name="datetime" placeholder="Date">
<i class="glyphicon glyphicon-calendar form-control-feedback"></i>
</div>
</div>
<div class="col-sm-5">
<div class="form-group has-feedback">
<input type="text" class="form-control" id="datetime" name="datetime" placeholder="Time">
<i class="glyphicon glyphicon-time form-control-feedback"></i>
</div>
</div>
</div>
This is a coursera assignment of Bootstrap
using the "With optional icons" method in Bootstrap you can achieve this:
for example, my answer to this question:
<div class="form-group has-feedback">
<label class="col-sm-2 control-label" for="date-choose">Date and Time</label>
<div class="col-sm-5">
<input type="date" class="form-control" id="date-choose" placeholder="Date">
<i class="glyphicon glyphicon-calendar form-control-feedback" aria-hidden="true"></i>
</div>
</div>
you can refer to the link below to find what you want:
http://getbootstrap.com/css/#forms-control-validation
The one more thing you have to know is that this only adds the icon to the input box but not changes the default action of the JavaScript behind it, so the icon you are adding has no response unless you change the default event of this input box.
I have the current setup.
<div class="container" data-ng-controller="publicHome">
<div class="col-md-4 col-md-offset-4" style="background: black;">
<form data-ng-submit="signIn()" class="form-horizontal">
<div class="form-group">
<input type="email" data-ng-model="email" placeholder="email" class="form-control">
</div>
<div class="form-group">
<input type="password" data-ng-model="password" placeholder="password" class="form-control">
</div>
<label class="checkbox pull-right">
remember me
<input type="checkbox" data-ng-model="rememberMe">
</label>
<div class="form-group center-block">
<button type="submit" class="btn btn-success center-block">sign in</button>
</div>
</form>
<div data-ng-bind="message" class="text-center">
</div>
</div>
</div>
I am trying to:
Get the check box on the right side of the remember me text AND have both of the right side of the form
Have the button on it's own row underneath the remember me
As you can see I'm nearly there!
Use:
<div class="form-group mycheckboxdiv">
<label>
remember me
<input type="checkbox" data-ng-model="rememberMe" class="pull-right mycheckbox">
</label>
</div>
and for your own css:
.mycheckbox{
margin-top:5px;
margin-left:5px;
}
.mycheckboxdiv{
text-align:right;
}
See this:
http://www.bootply.com/a6Jl6EDD8R
I am using Bootstrap3 in my project. I have enclosed my form in a jumbotron.
Here is how my form looks (not good looking as of now):
I tried to make it better. but it is getting worse. I want all the fields to be in one-line and
the submit button centered below them. I have no idea how to do it. I am very new using Bootstrap3.
Here is my html code:
<form action="" id="id-exampleForm" class="form-inline" method="post" >
<input type='hidden' name='csrfmiddlewaretoken' value='1bfhNFINdeJVpSNBBQd0X7zLWLVwm1bB' />
<div id="div_id_price_order" class="form-group">
<label for="id_price_order_0" class="control-label col-lg-2 requiredField">
price order
<span class="asteriskField">*</span>
</label>
<div class="controls col-lg-12">
<label class="radio">
<input type="radio" checked="checked" name="price_order" id="id_price_order_1" value="lowest_price" >lowest</label>
<label class="radio">
<input type="radio" name="price_order" id="id_price_order_2" value="highest_price" >highest</label>
</div>
</div>
<div class="form-group">
<div id="div_id_newest_entry" class="checkbox">
<div class="controls col-lg-offset-2 col-lg-12">
<label for="id_newest_entry" class=" requiredField">
<input class="checkboxinput checkbox" id="id_newest_entry" name="newest_entry" type="checkbox" />
latest date
</label>
</div>
</div>
</div>
<div class="form-group">
<div id="div_id_latest_year" class="checkbox">
<div class="controls col-lg-offset-2 col-lg-12">
<label for="id_latest_year" class=" requiredField">
<input class="checkboxinput checkbox" id="id_latest_year" name="latest_year" type="checkbox" />
latest year
</label>
</div>
</div>
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-primary button white" id="submit-id-submit" />
</form>
EDIT:
I want something like this: I have edited this on powerpoint. so it does not look very good.
EDIT AFTER COMMENT
Please see the fiddle for an inline form in a Jumbotron with the button in-line (not below centered), and fieldset.
Note : that I changed the vertical alignment of the checkbox and radio + add some right margin, and an extra small button. The form will go as block if the screen is extra-small as a bootstrap behavior.
JsFiddle
<div class="jumbotron">
<form class="form-inline">
<fieldset class="radiogroup">
<legend>Sorting Criteria</legend>
<label for="id_price_order_0">
price order
<span class="asteriskField">*</span>
</label>
<label class="radio" for="id_price_order_1">
lowest
<input type="radio" checked="checked" id="id_price_order_1" />
</label>
<label class="radio" for="id_price_order_2">
highest
<input type="radio" id="id_price_order_2" />
</label>
<label for="id_newest_entry" class="requiredField checkbox">
latest date
<input id="id_newest_entry" type="checkbox" />
</label>
<label for="id_latest_year" class="requiredField checkbox">
latest year
<input id="id_latest_year" type="checkbox" />
</label>
<input type="submit" name="submit" value="Submit" class="btn btn-primary btn-xs" />
</fieldset>
</form>
Add the class form-control to ALL of your input elements for a start:
<input type="radio" class='form-control' checked="checked" name="price_order" id="id_price_order_1" value="lowest_price" >
Also, what I do to make my life easier is to pre-wrap the elements in the correct sized divs instead of doing it in the labels and inputs like so:
<div class='row'>
<form ... >
<div class='col-lg-2>
<label ... ></label>
<input ... >
</div>
<div class='col-lg-2'>
...
</div>
...
</form>
</div>
Its a tiny bit slower to load but it makes the code so much more readable I think it is worth it. Also I feel that there is a lot of extra in your code that shouldn't be there and is confusing check out the code here: http://getbootstrap.com/css/#forms. They show you exactly how to format an in-line form.
Could being inside a .jumbotron be causing the issues? Why don't you try a panel or a well This should work for you:
<div class='panel panel-default'>
<div class="panel-heading">In-line Form</div>
<div class="panel-body">
<form action='anotherScript.php' method='post' class='form-inline'>
<div class='row'>
<div class='col-md-4'>
<strong>Price:</strong>
<div class="radio-inline">
<label>
<input type="radio" name="rad1" value="low" checked>
Lowest
</label>
</div>
<div class="radio-inline">
<label>
<input type="radio" name="rad1" value="high">
Highest
</label>
</div>
</div>
<div class='col-md-4'>
<div class="checkbox-inline">
<label>
<input type="checkbox" name='date' value='date'>
Latest Date
</label>
</div>
</div>
<div class='col-md-4'>
<div class="checkbox-inline">
<label>
<input type="checkbox" name='year' value='year'>
Latest Year
</label>
</div>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<center><button type='submit' class='btn btn-primary'>Submit</button></center></form>
</div>
</div>
</div>
Fiddle: http://jsfiddle.net/52VtD/5046/
Make sure you stretch the results panel to full width to see the form in-line.