Bootstrap dropdown login form floating out of screen - html

Here I am trying a sample bootstrap form that has a login dropdown, for username and password, I am including the code below, when the login form is activated, the form floats out of the menu on the right side of the screen, The code is below:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target="nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a href="#" class="brand" title="">
Test
</a>
<ul class="nav nav-pills pull-right">
<li>
<form class="input-append" method="GET" action="/search" style="margin-top:4px;margin-bottom:5px;">
<input type="text" title="Enter keyword(s) to find" id="TT" name="TT" class="span2" maxlength="40">
<button type="submit" class="bton">
<i class="icon-search" title="Search"></i>
</button>
</form>
</li>
<li class="dropdown" id="menuLogin">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="navLogin">Login</a>
<div class="dropdown-menu" style="padding:17px;">
<form id="formLogin" class="form">
<label>Login</label>
<input name="username" id="username" type="text" placeholder="Username" pattern="^[a-z,A-Z,0-9,_]{6,15}$" data-valid-min="6" title="Enter your username" required="">
<input name="password" id="password" type="password" placeholder="Password" title="Enter your password" required=""><br>
<button type="button" id="btnLogin" class="btn">Login</button>
</form>
<form>New User? Sign-up..</form>
<form id="formRegister" class="form collapse">
<input name="email" id="inputEmail" type="email" placeholder="Email" required="">
<input name="username" id="inputUsername" type="text" placeholder="Username" pattern="^[a-z,A-Z,0-9,_]{6,15}$" data-valid-min="6" title="Choose a username" required=""><br>
<input name="password" id="inputpassword" type="password" placeholder="Password" required="">
<input name="verify" id="inputVerify" type="password" placeholder="Password (again)" required=""><br>
<button type="button" id="btnRegister" class="btn">Sign Up</button>
</form>
</div>
</li>
</ul>
What is the problem in the dropdown, I tried a nav pull-left in the dropdown,
but it did not work, thanks.

Fixed the bug, the line reading:
<div class="dropdown-menu" style="padding:17px;">
should have a dropdown-menu-right added so the correct line should be:
<div class="dropdown-menu dropdown-menu-right" style="padding:17px;">
The "dropdown-menu-right" wraps the menu correctly!

Related

Modal not clickable

Here is what it looks like when I click it and it is not clickable it just have a color of black.
Here is what it should look like.
This for when I click Change Password
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-muted waves-effect waves-dark pro-pic"
href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Account</a>
<div class="dropdown-menu dropdown-menu-right user-dd animated">
<div class="dropdown-divider"></div>
<a class="dropdown-item" data-toggle="modal" data-placement="top" href="#account_edit"><i class="ti-settings "></i> Change Password</a>
This for the modal
<div class="modal fade" id="account_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<!-- ############## -->
<form action="account_edit.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<input disabled="disabled" type="email" name="user_email" value="<?php echo $row['user_email']; ?>" class="form-control" id="exampleInputEmail1" placeholder="" required>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" name="password" value="" class="form-control" id="exampleInputEmail1" placeholder="" required>
<input type="hidden" name="id" value="<?php echo $id; ?>" class="form-control" id="exampleInputEmail1" placeholder="" required>
</div>
<input type="submit" name="submit" value="Save" class="btn btn-success">
</form>
<!-- bodyyyyyyyyyyyy///// -->
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-primary" type="button">Close</button>
</div>
</div>
</div>
</div>

form-inline class of bootstrap 4 is displaying the controls in two rows in IE and Edge

I have below markup in html using bootstrap 4 which is being displayed in single row while the same is getting broken into two in IE Edge
<form class="form-inline" style="margin-top:10px;">
<label for="text" class="mr-sm-2">HOUR</label>
input type="text" class="form-control mb-2 mr-sm-2" id="HOUR">
<label for="text" class="mr-sm-2">MINUTE</label>
<input type="text" class="form-control mb-2 mr-sm-2" id="MINUTE">
<label for="text" class="mr-sm-2">SECONDS</label>
<input type="text" class="form-control mb-2 mr-sm-2" id="SECONDS">
<div class="dropdown" style="margin-left:20px;">
<button type="button" id="AMPM" class="btn btn-primary dropdown-toggle" style="width:160px;" data-toggle="dropdown">
AM/PM
</button>
<div class="dropdown-menu" id="SelectAMPM">
<a class="dropdown-item" href="#">AM</a>
<a class="dropdown-item" href="#">PM</a>
</div>
</div>
</form>
How to display entire form in one row in Internet Explorer and Edge? What bootstrap 4 classes needs to be added?
I've tested your code on my side and the form shows in one row in latest Edge and IE.
I wonder that what version of IE/Edge you've used to display two rows.
Besides, I would like to tell that when you use inline attribute the field goes from horizontal to vertical due to not enough space/width. You could see this from the link:
https://www.w3schools.com/bootstrap4/bootstrap_forms.asp
I've modified parts of the style by using the class form-control.Maybe you could refer to.
<form class="form-inline">
<div class="form-group">
<label for="text">HOUR</label>
<input id="HOUR" class="form-control input-group-lg" type="text" />
</div>
<div class="form-group">
<label for="text">MINUTE</label>
<input id="MINUTE" class="form-control input-group-lg" type="text" />
</div>
<div class="form-group">
<label for="text">SECONDS</label>
<input id="SECONDS" class="form-control input-group-lg" type="text" />
</div>
<div class="form-group">
<div class="dropdown" style="margin-left:20px;">
<button type="button" id="AMPM" class="btn btn-primary dropdown-toggle" style="width:160px;" data-toggle="dropdown">
AM/PM
</button>
<div class="dropdown-menu" id="SelectAMPM">
<a class="dropdown-item" href="#">AM</a>
<a class="dropdown-item" href="#">PM</a>
</div>
</div>
</div>
</form>

Fetching inputted form data in modal of different page

I have created a register form inside a modal of index page , when user submit it, user gets directed to 2nd page which is confirmation through PHP.
If users gets an error it is necessary to go back to previous page and fill the whole form again, how can i save the values inputted by user recently and when he gets redirected to previous page he see the form but filled of his recent values
<div class="modal fade" id="registermodal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true"> x </span><span class="sr-only">Close</span></button>
<h3 class="modal-title text-center" id="lineModalLabel"> Register </h3>
</div>
<div class="modal-body">
<!-- content goes here -->
<form action="confirmation.php" method="POST" enctype="multipart/form-data">
<div id="cfirstname" class="form-group" style="float:left;width:45%;">
<label for="firstname"> First Name </label>
<input oninvalid="this.setCustomValidity('Please enter your first name')" oninput="setCustomValidity('')" required type="text" class="form-control" id="firstname" name="firstname" placeholder="First name" autocomplete="off">
</div>
<div id="clastname" class="form-group" style="float:right;width:45%;">
<label for="lastname"> Last Name </label>
<input oninvalid="this.setCustomValidity('Please enter your last name')" oninput="setCustomValidity('')" required type="text" class="form-control" id="lastname" name="lastname" placeholder="Last name" autocomplete="off">
</div>
<div id="cemail" class="form-group" style="clear:both;">
<label for="email"> Email </label>
<input oninvalid="this.setCustomValidity('Please enter your email name')" oninput="setCustomValidity('')" required type="email" class="form-control" id="email" name="email" placeholder="Email" autocomplete="off">
</div>
<div id="ccategory" class="form-group" style="clear:both;">
<label for="category"> Category </label>
<input oninvalid="this.setCustomValidity('Category is Required')" oninput="setCustomValidity('')" required type="text" class="form-control" id="category" name="category" placeholder="Category" autocomplete="off"> <span class="help">Enter the category you are expert in </span>
</div>
<div class="form-group ">
<label for="Password"> Password </label>
<input oninvalid="this.setCustomValidity('Please enter a password)" oninput="setCustomValidity('')" required type="password" class="form-control" name="rpassword" id="password" placeholder="Password" autocomplete="off">
<span id="8char" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> 8 Characters Long<br>
</div>
<div class="form-group ">
<label for="Password">Confirm Password </label>
<input oninvalid="this.setCustomValidity('Please confirm your password')" oninput="setCustomValidity('')" required type="password" class="form-control" name="rcpassword" id="cpassword" placeholder="Repeat Password" autocomplete="off">
<span id="pwmatch" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> Passwords Match
</div>
<div id="cfblink" class="form-group">
<label for="fblink"> Facebook profile link </label>
<input type="text" class="form-control" id="fblink" name="fblink" placeholder="Facebook Link" autocomplete="off">
</div>
<div class="form-group">
<label for="ppic">Please upload an image of yourself</label>
<input class="btn btn-default" required="required" type="file" name="file" id="file">
<span id="cppic" class="glyphicon glyphicon-remove" style="color:#FF0004;"></span> Image uploaded
</div>
</div>
<div class="modal-footer">
<div class="btn-group btn-group-justified" role="group" aria-label="group button">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-dismiss="modal" role="button">Close</button>
</div>
<div class="btn-group" role="group">
<button type="submit" id="signup" name="signup" class="btn btn-default btn-hover-green" role="button"> Proceed </button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
well i found answer myself just put the variable as value input tag
<input oninvalid="this.setCustomValidity('Please enter your first name')" oninput="setCustomValidity('')" required type="text" class="form-control" id="firstname" name="firstname" placeholder="First name" autocomplete="off" <?php echo 'value="'.$variable_name.'"'; ?> >

How can I align vertically proportioned with the other text boxes the dropdown button here?

I'm using a primaly bootstrap from getbootstrap.com. I want to align properly the account type dropdown here. Also the dropdown list items are not properly aligned to the dropdown button. Please help.Thank you.
<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.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="form-horizontal" action="" method="post" enctype="multipart/form-data" align="center">
<div class="form-group">
<div class="col-sm-12">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Account type
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>Supplier</li>
<li>Client</li>
</ul>
</div>
</div>
<div class="form-group">
<label for="supplieruname" class="col-sm-2 control-label">Username:</label>
<div class="col-sm-4"><input type="text" class="form-control" id="supplieruname" placeholder="Username" tabindex="1" required></div>
</div>
<div class="form-group">
<label for="supplierpassword" class="col-sm-2 control-label">Set Password</label>
<div class="col-sm-4"><input type="text" class="form-control" id="supplierpassword" placeholder="Password" tabindex="2" float="right" required></div>
</div>
<div class="form-group">
<label for="acctype" class="col-sm-2 control-label">Account Type</label>
<div class="col-sm-4"><input type="text" class="form-control" id="acctype" placeholder="Company Name" tabindex="3" float="right" required></div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group"><input class="btn" type="submit" value="Save">
<input type="reset" class="btn" name="clear" value="Clear">
</div>
</div>
</form>
Add class btn-group to the dropdown.so the dropdown won't get the 100% width.Thus the dropdown menu will be aligned to center.Or add display:inline-block style to the .dropdown
<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.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="form-horizontal" action="" method="post" enctype="multipart/form-data" align="center">
<div class="form-group">
<div class="col-sm-12">
<div class="dropdown btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Account type
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>Supplier</li>
<li>Client</li>
</ul>
</div>
</div>
<div class="form-group">
<label for="supplieruname" class="col-sm-2 control-label">Username:</label>
<div class="col-sm-4"><input type="text" class="form-control" id="supplieruname" placeholder="Username" tabindex="1" required></div>
</div>
<div class="form-group">
<label for="supplierpassword" class="col-sm-2 control-label">Set Password</label>
<div class="col-sm-4"><input type="text" class="form-control" id="supplierpassword" placeholder="Password" tabindex="2" float="right" required></div>
</div>
<div class="form-group">
<label for="acctype" class="col-sm-2 control-label">Account Type</label>
<div class="col-sm-4"><input type="text" class="form-control" id="acctype" placeholder="Company Name" tabindex="3" float="right" required></div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group"><input class="btn" type="submit" value="Save">
<input type="reset" class="btn" name="clear" value="Clear">
</div>
</div>
</form>
For the time being, you can apply the following come back later to fix.
Fix it on the page.
<style>
.dropdown, .dropup {
position: fixed;
z-index: 999;
float:center;
}
.form-group{margin-bottom:20px;}
</style>

How to turn an HTML navbar <li> into a stand-alone button

I am using Bootstrap to create a website and I added functionality for a drop-down to sign up for a newsletter.
How can I make that drop-down into a standalone drop-down separate from the navbar?
I added <button> tags around the entire html code but the sign-up button then separates from the drop-down. Ideally, it would be at the bottom of the drop-drown.
<button class="dropdown btn">
Newsletter Sign Up <b class="caret"></b>
<ul class="dropdown-menu" style="padding: 15px;min-width: 250px;">
<li>
<div class="row">
<div class="col-md-12">
<form class="form" role="form" method="post" action="login" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="newsletter-signup-name">Name</label>
<input type="email" class="form-control" id="newsletter-signup-name" placeholder="Name" required>
</div>
<div class="form-group">
<label class="sr-only" for="newsletter-signup-email">Email</label>
<input type="email" class="form-control" id="newsletter-signup-email" placeholder="Email address" required>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block">Sign Up</button>
</div>
</form>
</div>
</div>
</li>
<li class="divider"></li>
</ul>
</button>
Not sure why you want to encapsulate the entire form into the button. Use a button instead of an anchor if you need the button.
<div class="dropdown">
<button class="btn dropdown-toggle" data-toggle="dropdown">Newsletter Sign Up <b class="caret"></b>
</button>
<ul class="dropdown-menu" style="padding: 15px;min-width: 250px;">
<li>
<div class="row">
<div class="col-md-12">
<form class="form" role="form" method="post" action="login" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="newsletter-signup-name">Name</label>
<input type="email" class="form-control" id="newsletter-signup-name" placeholder="Name" required>
</div>
<div class="form-group">
<label class="sr-only" for="newsletter-signup-email">Email</label>
<input type="email" class="form-control" id="newsletter-signup-email" placeholder="Email address" required>
</div>
<div class="checkbox">
<label>
<input type="checkbox">Remember me</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block">Sign Up</button>
</div>
</form>
</div>
</div>
</li>
<li class="divider"></li>
</ul>
</div>
http://jsfiddle.net/moogs/sktewe4s/
Just use a div instead of a button. I think that buttons are not allowed to contain other form elements.
<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 rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<div class="dropdown">
Newsletter Sign Up <b class="caret"></b>
<ul class="dropdown-menu" style="padding: 15px;min-width: 250px;">
<li>
<div class="row">
<div class="col-md-12">
<form class="form" role="form" method="post" action="login" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="newsletter-signup-name">Name</label>
<input type="email" class="form-control" id="newsletter-signup-name" placeholder="Name" required>
</div>
<div class="form-group">
<label class="sr-only" for="newsletter-signup-email">Email</label>
<input type="email" class="form-control" id="newsletter-signup-email" placeholder="Email address" required>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block">Sign Up</button>
</div>
</form>
</div>
</div>
</li>
<li class="divider"></li>
</ul>
</div>