Bootstrap login and signup forms are not aligning - html

I want my Signup and Login form at the same place .By default i want to show the Signup form . On Login Button Click event i want Signup form should be replaced by Login form at the same place or position but its not happening . What is happening is Signup form is coming at top while login form is coming at down . To see the result as of now i have removed Visibility css ..
Here is my Markup ..
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="top-content">
<div class="inner-bg">
<div class="container">
<div class="row">
<div class="col-sm-7 text">
<h1><strong>Custom</strong> Authentication Form</h1>
<div class="description">
<p>
Please register or enter credentials to enjoy the app
</p>
</div>
<!-- Trying to add Angular JS Snippet !-->
<div ng-controller="LoginController" class="top-big-link">
<a class="btn btn-link-1" href="" ng-click="$event.preventDefault();Register()">Login</a>
</div>
</div>
<!-- Signup Form Here !-->
<div ng-controller="SignupformController" class="col-sm-5 form-box">
<div class="form-top">
<div class="form-top-left">
<h3>Sign up now</h3>
<p>Fill in the form below to get instant access:</p>
</div>
<div class="form-top-right">
<i class="fa fa-pencil"></i>
</div>
<div class="form-top-divider"></div>
</div>
<div class="form-bottom">
<form role="form" action="" method="post" class="registration-form">
<div class="form-group">
<label class="sr-only" for="form-first-name">First name</label>
<input type="text" name="form-first-name" placeholder="First name..." class="form-first-name form-control" id="form-first-name">
</div>
<div class="form-group">
<label class="sr-only" for="form-last-name">Last name</label>
<input type="text" name="form-last-name" placeholder="Last name..." class="form-last-name form-control" id="form-last-name">
</div>
<div class="form-group">
<label class="sr-only" for="form-email">Email</label>
<input type="text" name="form-email" placeholder="Email..." class="form-email form-control" id="form-email">
</div>
<button type="submit" class="btn">Sign me up!</button>
</form>
</div>
</div>
<!-- Login Form Here !-->
<div ng-controller="LoginformController" class="col-sm-5 form-box">
<div class="form-top">
<div class="form-top-left">
<h3>Login now</h3>
<p>Fill in the form below to get instant access:</p>
</div>
<div class="form-top-right">
<i class="fa fa-pencil"></i>
</div>
<div class="form-top-divider"></div>
</div>
<div class="form-bottom">
<form role="form" action="" method="post" class="registration-form">
<div class="form-group">
<label class="sr-only" for="UserID">User ID</label>
<input type="text" name="UserID" placeholder="User ID..." class="form-first-name form-control" id="UserID">
</div>
<div class="form-group">
<label class="sr-only" for="Password">Password</label>
<input type="text" name="Password" placeholder="Password..." class="form-last-name form-control" id="Password">
</div>
<button type="submit" class="btn">Login!</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Please help me to resolve this ..

This is how I did it:
<div class="col-sm-7 text">
<h1><strong>Atlas</strong> Authentication Form</h1>
<div class="description">
<p>Please register or enter credentials to enjoy the app</p>
</div>
<ul class="nav nav-pills" id="myTab">
<li class="active">Sign Up </li>
<li>Log In </li>
</ul>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active" id="signup">
<div ng-controller="SignupformController" class="col-sm-5 form-box">
...
</div>
</div>
<div class="tab-pane" id="login">
<div ng-controller="LoginformController" class="col-sm-5 form-box">...</div>
</div>
</div>
Here is the JSFiddle demo
What you are actually to achieve is basically the way bootstrap nav-pills work. You just need to display the buttons as nav-pills and then set the respective contents in tab-content class.
Using data-toggle="pill" will automatically switch between the tabs and contents.
(You can add the fade class along the tab-pane class to give the switching a little effect like this :) )

Related

Preventing password box auto select

I am learning django and have built a very basic profile form, I am experiencing a strange issue during page load.
The profile page has a password change form which is at the page bottom and during the browser loading, it auto-navigates to this form and enters the first input field of the form?
Has anyone experienced this and if so how do i prevent this from occurring?
Form on load:
<div class="col-lg-4">
<div class="block">
<!-- Table Styles Title -->
<div class="block-title">
<h2><strong>Change Password</strong></h2>
</div>
<p>Change your password here!</p
<form action="/profile/change_password/" method="post" class="form-horizontal">
<input type="hidden" name="csrfmiddlewaretoken" value="Azuwo63bFBZyum9WJSwwp8gwNcdBKw0cvURhLHoZcVDTsq7ecAJArZTYFE0dHleB">
<div class="col-xs-12">
<div id="div_id_old_password" class="form-group">
<label for="id_old_password" class=" requiredField">
Old password<span class="asteriskField">*</span> </label>
<div class="">
<input type="password" name="old_password" autocomplete="current-password" autofocus class="textinput textInput form-control" required id="id_old_password"> </div>
</div>
<div id="div_id_new_password1" class="form-group">
<label for="id_new_password1" class=" requiredField">
New password<span class="asteriskField">*</span> </label>
<div class="">
<input type="password" name="new_password1" autocomplete="new-password" class="textinput textInput form-control" required id="id_new_password1"> <small id="hint_id_new_password1" class="form-text text-muted"><ul><li>Your password can’t be too similar to your other personal information.</li><li>Your password must contain at least 8 characters.</li><li>Your password can’t be a commonly used password.</li><li>Your password can’t be entirely numeric.</li></ul></small> </div>
</div>
<div id="div_id_new_password2" class="form-group">
<label for="id_new_password2" class=" requiredField">
New password confirmation<span class="asteriskField">*</span> </label>
<div class="">
<input type="password" name="new_password2" autocomplete="new-password" class="textinput textInput form-control" required id="id_new_password2"> </div>
</div>
</div>
<!-- Form Buttons -->
<div class="form-group form-actions">
<div class="col-xs-12 text-right">
<button type="submit" class="btn btn-sm btn-success"> Change Password</button>
</div>
</div>
<!-- END Form Buttons -->
</form>
</div>
Django Template:
<div class="col-lg-4">
<div class="block">
<!-- Table Styles Title -->
<div class="block-title">
<h2><strong>Change Password</strong></h2>
</div>
<p>Change your password here!</p>
<form action="{% url 'change_password'%}" method="post" class="form-horizontal">
{% csrf_token %}
<div class="col-xs-12">
{{ passform|crispy }}
</div>
<!-- Form Buttons -->
<div class="form-group form-actions">
<div class="col-xs-12 text-right">
<button type="submit" class="btn btn-sm btn-success"> Change Password</button>
</div>
</div>
<!-- END Form Buttons -->
</form>
</div>
I am not using javascript on this page it really is a basic setup for learning.
Many thanks

Two of my pages have a small gap under the footer

All of my other pages do not have this gap, I am using Bootstrap but am a beginner. What do you think it could be? Is the whole page coded wrong because the contact form works fine, just when I am on a mobile device I can see a very thin white line under the footer.
<div class="section-md">
<div class="container container-normal">
<div class="row">
<div class="col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
<div class="panel panel-default">
<div class="panel-body">
<?php if (isset($_SESSION[ 'contact_success'])): ?>
<h2>Message Sent</h2>
<div class="alert alert-success">
Your information has been received. We will contact you within 1 business day.
</div>
Back to Homepage
<?php unset($_SESSION[ 'contact_success']) ?>
<?php else: ?>
<h1>Contact Us</h1>
<p class="text-muted">This is our contact page...</p>
<hr>
<div class="error-msg alert alert-danger cnt-error">
<p>Please fill in all required fields.</p>
</div>
<form id="contact_form" action="<?= site_url() ?>contact/save" method="post">
<div class="form-group">
<label for="name" class="form-label">Your Name*</label>
<input id="cnt_name" type="text" class="form-control" name="name" placeholder="Your Name">
</div>
<div class="form-group">
<label for="email" class="form-label">Your Email*</label>
<input id="cnt_email" type="text" class="form-control" name="email" placeholder="user#example.com">
</div>
<div class="form-group">
<label for="subject" class="form-label">Subject*</label>
<input id="cnt_subject" type="text" class="form-control" name="subject" placeholder="This website rocks">
</div>
<div class="form-group">
<label for="message" class="form-label">Comments*</label>
<textarea id="cnt_message" class="form-control" name="message" rows="10" placeholder="Enter a few questions in here..."></textarea>
</div>
<div class="form-group">
<button class="btn btn-primary">Submit</button>
Cancel
</div>
<!-- /.form-group -->
</form>
<?php endif ?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.section-md -->
I think you had margin in your
Let's try this code
body{
margin: 0;
}

Why is bootstrap form and pannel overlapping?

I am using bootstrap and I have a div panel and after it a form, and I have this same structured element twice. The form and the panel dive after it are overlapping. Here is my html:
<div class="comment">
<div class="panel panel-default">
<div class="panel-heading">
user1
</div>
<div class="panel-body">
test comment
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
<div class="comment">
<div class="panel panel-default">
<div class="panel-heading">
user 2
</div>
<div class="panel-body">
test comment
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
and here is a fiddle to see what I mean by overlapping
I want the the width of the form to be limited, that is why i put class="form col-xs-4"
Use class="row" before use bootstrap col-*-* class
your code like
<div id="comment">
<div class="panel panel-default">
<div class="panel-heading">
user1
</div>
<div class="panel-body">
test comment
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
<div class="row">
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
</div>
<div id="comment">
<div class="panel panel-default">
<div class="panel-heading">
user 2
</div>
<div class="panel-body">
test comment
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
<div class="row">
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
</div>
your form is not in the right div. You put it after the footer of the first panel and before the following panel.
This solves it :
<div id="main">
<div class="panel panel-default">
<div class="panel-heading">
user1
</div>
<div class="panel-body">
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
</div>
<div id="comment">
<div class="panel panel-default">
<div class="panel-heading">
user 2
</div>
<div class="panel-body">
<form class="form col-xs-4" id="commentForm" action="comment.php" method="post" style="display:">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" />
</div>
<div class="form-group">
<label for="comment">Comment:</label>
<textarea class="form-control" id="comment"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Submit Comment" />
</div>
</form>
</div>
<div class="panel-footer">
<ul class="list-inline">
<li id="reply">reply</li>
<li id="expand"> expand</li>
</ul>
</div>
</div>
</div>
Be also careful, you had several div with the same id and this is not viable.
Please see Updated code.
https://jsfiddle.net/v5da7qeq/2/
Hope this will work !
If you opt for a full width form layout you can just remove the col-xs-4 class from your forms.
<form class="form" id="commentForm" action="comment.php" method="post" style="display:">
https://jsfiddle.net/Neviton/v5da7qeq/4/

Bootstrap popover is too narrow

http://jsfiddle.net/0y8oy7gf/2/
I have a Bootstrap 3 form in which I have a popover that is placed at the right of the first text input. The popover is triggered on focus of that input, and the trigger is working correctly. My problem is that I'd like for the popover to be wider so that I can have longer lines of text, but it seems to be contained within the parent .col-xs-6. Is there any way to have it be contained by .container-fluid instead, so that it can occupy the empty space on the right?
HTML is below, and the above jsfiddle demonstrates the problem. Thanks!
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-xs-6 col-xs-offset-3 panel panel-gray floating">
<div class="panel-body">
<form action="?" method="POST" id="foo">
<div class="form-group">
<h3>Set your new password</h2>
</div>
<div class="form-group form-group-lg">
<label for="new-password">New password</label>
<input type="password" class="form-control" id="new-password" autofocus data-toggle="popover" data-content="8-20 characters long" data-trigger="focus" data-placement="right" viewport="container">
</div>
<div class="form-group form-group-lg">
<label for="confirm-new-password">Confirm new password</label>
<input type="password" class="form-control" id="confirm-new-password">
</div>
<div class="form-group form-group-lg">
<label for="security-answer">Answer your security question:</label>
<p id="security-question">How many cups of sugar does it take to get to the moon?</p>
<input type="text" class="form-control" id="security-answer">
</div>
<div class="btn-group-lg">
<input type="submit" value="Change password" class="btn btn-primary btn-block" id="btn_changePassword">
</div>
</form>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
You simply need to set the data-container attribute to tell the popover which element to use as it's containing element (see the documentation):
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-xs-6 col-xs-offset-3 panel panel-gray floating">
<div class="panel-body">
<form action="?" method="POST" id="foo">
<div class="form-group">
<h3>Set your new password</h2>
</div>
<div class="form-group form-group-lg">
<label for="new-password">New password</label>
<input type="password" class="form-control" id="new-password" autofocus data-toggle="popover" data-container=".container-fluid" data-content="8-20 characters long" data-trigger="focus" data-placement="right" viewport="container">
</div>
<div class="form-group form-group-lg">
<label for="confirm-new-password">Confirm new password</label>
<input type="password" class="form-control" id="confirm-new-password">
</div>
<div class="form-group form-group-lg">
<label for="security-answer">Answer your security question:</label>
<p id="security-question">How many cups of sugar does it take to get to the moon?</p>
<input type="text" class="form-control" id="security-answer">
</div>
<div class="btn-group-lg">
<input type="submit" value="Change password" class="btn btn-primary btn-block" id="btn_changePassword">
</div>
</form>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
http://jsfiddle.net/0y8oy7gf/3/

tab views with bootstrap and angular

I made a tab view using bootstrap for a angular template. but when i click on the tab it goes to the angular link router instead of going to the tab content.it may be because i have them as links but at the moment i really don't have any idea of how im going to solve this
<ul class="nav nav-tabs">
<li class="active">Where you heading <i class="fa"></i></li>
<li>Description<i class="fa"></i></li>
</ul>
<form id="rideForm" method="post" class="form-horizontal">
<div class="tab-content">
<div class="tab-pane active" id="info-tab">
<div class="form-group">
<label class="col-sm-2 control-label">From:</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="fullName" />
</div>
<label class="col-sm-2 control-label">To:</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="Email" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Time:</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="jobTitle" />
</div>
</div>
<div id="ridebuttongroup" class="col-sm-5 col-sm-offset-3">
<a href="#address-tab" data-toggle="tab"><button type="next" class="btn btn-default">
<span class="glyphicon glyphicon-circle-arrow-right"></span> Next </button></a>
</div>
</div>
<div class="tab-pane" id="address-tab">
<div class="form-group">
<label class="col-sm-3 control-label">Description</label>
<div class="col-sm-5">
<textarea rows="4" cols="50"></textarea>
</div>
</div>
<div id="ridebuttongroup" class="col-sm-5 col-sm-offset-3">
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-plane"></span> Ride</button>
<a href="#info-tab" data-toggle="tab"><button type="next" class="btn btn-default">
<span class="glyphicon glyphicon-circle-arrow-left"></span> Previous </button></a>
</div>
</div>
</div>
<div style="margin: 15px">
</div>
</form>
please help!
Stop banging your head against the wall and just use http://angular-ui.github.io/bootstrap/
A quick work around to this issue is to add:
target="_blank"
to your links. Angular, behind the scenes, does stuff to your links which is why you're having that problem.
This is a temp. solution to the issue.