I'm trying to implement the same CSS for an input of type text as similar to the one we have in CreateUser default page. So when you click on User Name textbox it shows a blue line under it. Same I tried on my page it works fine, but when I go to other page and come to this page again, it does not show the blue line under the textbox.
create-user.component
<div bsModal #createUserModal="bs-modal" class="modal fade" (onShown)="onShown()" tabindex="-1" role="dialog" aria-labelledby="createUserModal" aria-hidden="true" [config]="{backdrop: 'static'}">
<div class="modal-dialog">
<div #modalContent class="modal-content">
<form *ngIf="active" #createUserForm="ngForm" id="frm_create_user" novalidate (ngSubmit)="save()">
<div class="modal-header">
<button type="button" class="close" (click)="close()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span>{{l("CreateNewUser")}}</span>
</h4>
</div>
<div class="modal-body">
<ul class="nav nav-tabs tab-nav-right" role="tablist">
<li role="presentation" class="active">User Details</li>
<li role="presentation">User Roles</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane animated fadeIn active" id="user-details">
<div class="row clearfix" style="margin-top:10px;">
<div class="col-sm-12">
<div class="form-group form-float">
<div class="form-line">
<input id="username" type="text" name="UserName" [(ngModel)]="user.userName" required maxlength="32" minlength="2" class="validate form-control">
<label for="username" class="form-label">{{l("UserName")}}</label>
</div>
</div>
</div>
</div>
mypage.html
<div class="row clearfix" [#routerTransition]>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card main-content">
<div class="row" style="background-color:white;">
<div class="header">
<h2>
{{l('MyPage: ADD/EDIT')}}
</h2>
</div>
<br />
<form *ngIf="active" #myForm="ngForm" id="frm_create_store" novalidate (ngSubmit)="onSubmitBtnClick(myForm)">
<div class="col-md-12">
<div class="form-group form-float">
<label for="myName" class="form-label">{{l("myName")}}</label>
<div class="form-line">
<input id="myName" type="text" name="myName" [(ngModel)]="name.myName" placeholder="{{l('EnterNAME')}}" required maxlength="32" class="validate form-control">
</div>
</div>
</div>
I think you need to label with form="myName" inside the div which has class="form-line".
Instead of;
<label for="myName" class="form-label">{{l("myName")}}</label>
<div class="form-line">
<input id="myName" type="text" name="myName" [(ngModel)]="name.myName" placeholder="{{l('EnterNAME')}}" required maxlength="32" class="validate form-control">
</div>
Try this;
<div class="form-line">
<label for="myName" class="form-label">{{l("myName")}}</label>
<input id="myName" type="text" name="myName" [(ngModel)]="name.myName" placeholder="{{l('EnterNAME')}}" required maxlength="32" class="validate form-control">
</div>
Related
I am working on a modal that adds the product. The modal has seperated tabs which is needed to add details. The question is that how can I handle validation.
Each tab has own form and submit button is the same. Also the "required" rule is not working. Any help please ?
Edit: Html code added. Don't read description after here. Because text is mostly code so I need to add more description. Also is there a way to handle this issue.
<div class="modal fade" id="product_add_modal" tabindex="-1" role="dialog" aria-labelledby="tab_modal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header p-b-15">
<h4 class="modal-title">Product Setup</h4>
<ul class="card-actions icons right-top">
<a href="javascript:void(0)" data-dismiss="modal" class="text-white" aria-label="Close">
<i class="zmdi zmdi-close"></i>
</a>
</ul>
</div>
<div class="modal-body p-0">
<div class="tabpanel">
<ul class="nav nav-tabs p-0">
<li class="active" role="presentation">General Info</li>
<li role="presentation">Product Images</li>
<li role="presentation">Price</li>
<li role="presentation">Inventory</li>
<li role="presentation">Shipping</li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane fadeIn active" id="product_add_general">
<div class="card card p-20 p-t-10 m-b-0">
<div class="card-body">
<form class="form-horizontal" action="/somewhere" method="POST">
#csrf
<div class="form-group label-floating is-empty">
<label class="control-label">Title</label>
<input type="text" name="name" class="form-control" required>
</div>
<div class="form-group">
<textarea id="add_product_desc" required></textarea>
</div>
<div class="chips chips-placeholder"></div>
</form>
</div>
</div>
</div>
<div class="tab-pane fadeIn" id="product_add_images">
<div class="card card p-20 p-t-10 m-b-0">
<div class="card-body">
<form action="#" class="dropzone" id="product_add_images_form" enctype="multipart/form-data"></form>
</div>
</div>
</div>
<div class="tab-pane fadeIn" id="product_add_price">
<div class="card card p-20 p-t-10 m-b-0">
<div class="card-body">
<form>
<div class="row">
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<div class="input-group">
<span class="input-group-addon">$</span>
<label class="control-label">Price</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<div class="input-group">
<span class="input-group-addon">$</span>
<label class="control-label">Compare at price</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<div class="togglebutton m-b-15 ">
<label>
<input type="checkbox" class="toggle-info" checked> Charge taxes on this product
</label>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="tab-pane fadeIn" id="product_add_inventory">
<div class="card card p-20 p-t-10 m-b-0">
<div class="card-body">
<form>
<div class="row">
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<label class="control-label">SKU (Stock Keeping Unit)</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<label class="control-label">Barcode (ISBN, UPC, GTIN, etc.)</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="" class="control-label">Inventory policy</label>
<select class="select form-control">
<option selected>Don't track inventory</option>
<option>Track this product's inventory</option>
</select>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="tab-pane fadeIn" id="product_add_shipping">
<div class="card card p-20 p-t-10 m-b-0">
<div class="card-body">
<form>
<div class="row">
<div class="col-md-4">
<div class="form-group label-floating is-empty">
<label class="control-label">Width</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group label-floating is-empty">
<label class="control-label">Height</label>
<input type="text" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group label-floating is-empty">
<label class="control-label">Depth</label>
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<div class="input-group">
<label class="control-label">Weight</label>
<input type="text" class="form-control" aria-label="...">
<div class="input-group-btn suffix-select">
<select class="select form-control">
<option>lb</option>
<option>kg</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group label-floating is-empty">
<div class="input-group">
<span class="input-group-addon">$</span>
<label class="control-label">Extra Shipping Fee</label>
<input type="text" class="form-control">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-flat" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Add Product</button>
</div>
</div>
<!-- modal-content -->
</div>
<!-- modal-dialog -->
</div>
</div>
Bootstrap Data toggle collapse is not working. Issue is that when click on second link then first link is not toggle collapse
**Fiddle**
Demo
Try it. Now if you click on second link then first link is collapse.
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
</head>
<body>
<div id="accordion">
<div class="card card-plain">
<div class="card-header" role="tab" id="heading1">
<a data-toggle="collapse" aria-expanded="true" aria-controls="collapse1" data-target="#collapse1">
Company Information
<i class="now-ui-icons arrows-1_minimal-down"></i>
</a>
</div>
<div id="collapse1" class="collapse show" role="tabpanel" aria-labelledby="heading1" data-parent="#accordion">
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<label>Company Name</label>
<input class="form-control" id="comp_entity" name="comp_entity" type="text" placeholder="Company Name" value="">
</div>
<div class="col-sm-6">
<label>Business Unit / Division</label>
<input class="form-control" id="bus_unit_div" name="bus_unit_div" type="text" placeholder="Business Unit / Division" value="">
</div>
</div>
</div>
</div>
</div>
<div class="card card-plain">
<div class="card-header" role="tab" id="heading2">
<a class="collapsed" data-toggle="collapse" aria-expanded="false" aria-controls="collapse2" data-target="#collapse2">
Employee Information
<i class="now-ui-icons arrows-1_minimal-down"></i>
</a>
</div>
<div id="collapse2" class="collapse" role="tabpanel" aria-labelledby="heading2" data-parent="#accordion">
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<label>Job title / role</label>
<input class="form-control" id="job_title" name="job_title" type="text" placeholder="Job Title / Role" value="">
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label>Hours of Work</label>
<input class="form-control" id="hours_of_work" name="hours_of_work" type="text" placeholder="Hours of Work" onkeyup="this.value = this.value.replace(/[^0-9]/, '')" value="">
</div>
<div class="col-sm-6">
<label>Performance Rating</label>
<input class="form-control" id="perform_rating" name="perform_rating" type="text" placeholder="Performance Rating" value="">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label>Personnel (Staff) Number</label>
<input class="form-control" id="personal_staff_num" name="personal_staff_num" type="text" placeholder="Personnel (Staff) number" onkeyup="this.value = this.value.replace(/[^0-9]/, '')" value="">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
otherwise
please remove class show in the first tab content div
from
<div id="collapse1" class="collapse show" role="tabpanel" aria-labelledby="heading1">
to
<div id="collapse1" class="collapse" role="tabpanel" aria-labelledby="heading1">
and it will work.
use 'in' instead of 'show' in below code
<div id="collapse1" class="collapse in" role="tabpanel" aria-labelledby="heading1">
I have a basic modal that has 3 fields. Name, email, and message. The email and message appear perfectly. The name input field doesn't appear. It only appears when Name label is clicked. May I ask why it does this and how can I override it so it displays normal like email and message.
<div class="modal fade" id="contact" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal">
<div class="modal-header">
<h4>Contact Tech Site</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="contact-name" class="col-lg-2 control-label">Name:</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="contact-name" placeholder="Full Name">
</div>
</div>
<div class="form-group">
<label for="contact-email" class="col-lg-2 control-label">Email:</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="contact-email" placeholder="you#example.com">
</div>
</div>
<div class="form-group">
<label for="contact-msg" class="col-lg-2 control-label">Message:</label>
<div class="col-lg-10">
<textarea class="form-control" rows="8"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-default" data-dismiss="modal">Close</a>
<button class="btn btn-primary" type="submit">Send</button>
</div>
</form>
</div>
</div>
</div>
I wasn't able to replicate this in codepen. How it appears http://snag.gy/7Zd3f.jpg
It's working for me, try taking out "fade" from first line.
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 :) )
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.