<div formArrayName="partners" style="margin-top:15px;" *ngIf="partner">
<div *ngFor="let partner of partners().controls; let i = index" [formGroupName]="i">
<div class="partner-background">
<div class="row">
<div class="col col-12">
<h6 style="padding:5px;">Manage Partner <button id="remove" class="btn" style="float:right;" *ngIf="partners().length > 1 && i>0" (click)="removePartner(i)"><i class="fas fa-minus-circle"></i></button></h6>
</div>
<div class="col col-6">
<div class="input-group mb-3 mt-1">
<div class="input-group-prepend">
<span class="input-group-text">Full Name</span>
</div>
<input type="text" class="form-control" formControlName="p_first_name">
</div>
</div>
<div class="col col-6">
<div *ngFor="let type of types().controls; let j = index" [formGroupName]="j">
<div class="row" style="margin-top:5px;">
<div class="col col-3">
<label for="type" style="font-size:18px;">Type</label>
</div>
<div class="col col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="partner" formControlName="p_type" style="width:16px;height:16px;" value="urban">
<label class="form-check-label">Urban</label>
</div>
</div>
<div class="col col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="partner" formControlName="p_type" style="width:16px;height:16px;" value="rural">
<label class="form-check-label">Rural</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col col-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">DOB</span>
</div>
<input type="text" class="form-control" formControlName="p_dob">
</div>
</div>
<div class="col col-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Sex</span>
</div>
<!-- <input type="text" class="form-control" formControlName="p_sex"> -->
<select class="form-control" formControlName="p_sex">
<option value="" selected>Select sex</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col col-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Email</span>
</div>
<input type="text" class="form-control" formControlName="p_email">
</div>
</div>
<div class="col col-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Phone No</span>
</div>
<input type="text" class="form-control" formControlName="p_phone">
</div>
</div>
</div>
</div>
</div>
In most cases, you need to add multiple form controls inside one form group or multiple form controls inside the form array.
For checkbox, you need to add multiple form controls inside one formArray like this.
const arr = [this.fb.control(false), this.fb.control(false)];
fbArray = this.fb.array(arr);
const form = this.fb.group({
checkbox: fbArray,
});
Related
This is my first post on stackoverflow, so forgive me if I make mistakes.
Would like to reverse these 2 columns in bootstrap and it doesn't work. Tried with order-2 but no luck.
<div class="flexbox">
<div class="container list">
<div class="row">
<h1>Customers</h1>
</div>
<div class="row">
<div class="col-sm-3 order-2">
<div class="list-group" id="supplier-list">
</div>
</div>
<div class="col-sm-6 order-">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon">Name</div>
</div>
<input type="text" id="supplier-name" class="form-control" aria-label="Input group example">
</div>
<br>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon">CUI</div>
</div>
<input type="text" id="supplier-cui" class="form-control" aria-label="Input group example">
</div>
<br>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon">ID</div>
</div>
<input type="text" id="supplier-id" class="form-control" aria-label="Input group example">
</div>
<br>
<button type="button" id="suppliers-update" class="btn btn-success">Update</button>
<button type="button" id="suppliers-delete" class="btn btn-danger">Delete</button>
</div>
</div>
</div>
</div>
I'm using visual studio 2019 and bootstrap4 (which I'm new to) to develop a web page for account registration. The render does not seem right. I remove ASP tags from the code below. I use a combination of codes from www.w3schools.com/bootstrap4. Below is the code I tried.
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Country</span>
</div>
<select class="form-control"><option>1</option></select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Business Name</span>
</div>
<input type="text" class="form-control" placeholder="Business Name">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
Street</span>
</div>
<input type="text" class="form-control" placeholder="Street, including Building number and Suite">
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
City</span>
</div>
<input type="text" class="form-control" placeholder="City">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
State</span>
</div>
<select class="form-control"><option>1</option></select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
Zip code</span>
</div>
<input type="text" class="form-control" placeholder="Zip code"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
Telephone</span>
</div>
<input type="text" class="form-control" placeholder="Telephone">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
Email Address</span>
</div>
<input type="text" class="form-control" placeholder="Email address">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">
Website</span>
</div>
<input type="text" class="form-control" placeholder="Website">
</div>
</div>
</div>
</div>
The input fields do not properly align. Can anyone help why the render does not properly align?
After reading the question and the comments it seems you are having trouble with form-control as it is not going up to its full width. That is because you have a custom css file in Content folder of your project structure that overrides the behavior of few tags. See:
Here you can see input,select,textarea tags have been overridden and you can just remove it or comment it out to make it go full width:
UPDATE:
I also noticed that your html for input controls is also incorrect and not well formatted. Here is the correct version of it:
<style>
.input-group {
width: 100% !important;
}
</style>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Country</span>
</div>
<select class="form-control">
<option>1</option>
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Business Name</span>
</div>
<input type="text" class="form-control" placeholder="Business Name">
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Street</span>
</div>
<input type="text" class="form-control" placeholder="Street, including Building number and Suite">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">City</span>
</div>
<input type="text" class="form-control" placeholder="City">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">State</span>
</div>
<select class="form-control">
<option>1</option>
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Zip code</span>
</div>
<input type="text" class="form-control" placeholder="Zip code">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Telephone</span>
</div>
<input type="text" class="form-control" placeholder="Telephone">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Email Address</span>
</div>
<input type="text" class="form-control" placeholder="Email address">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-2 col-md-4">
<div class="form-inline">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Website</span>
</div>
<input type="text" class="form-control" placeholder="Website">
</div>
</div>
</div>
</div>
</div>
See the output here.
I am trying to improve my Bootsrap skills but need help for an issue about card and forms.
Trying to fit form in card but couldn't make it. Has anyone an idea about this issue?
<div class="row row-content col-sm-8">
<div class="card">
<h3 class="card-header card-warning" style="width: 100%">Featured</h3>
<form class="form-group col-sm-12 row">
<div class="col col-md-3 col-sm-3">
<label><strong>Number of Guests</strong></label>
</div>
<div class="col col-md-9 col-sm-9 align-items-center">
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
</label>
</div>
<div class="col-xs-12 col-sm-3 align-items-center">
<p style="padding: 10px"></p>
<p><strong>Date and Time</strong></p>
</div>
<div class="col-sm-9 col-md-9 form-inline">
<label class="sr-only" for="inlineFormInput">Date</label>
<input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" id="inlineFormInput" placeholder="Date">
<label class="sr-only" for="inlineFormInputGroup">Time</label>
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<input type="text" class="form-control" id="inlineFormInputGroup" placeholder="Time">
</div>
</div>
<div class="col-sm-3">
</div>
<div class="col col-offset">
<a class="btn btn-primary" href="#">Reserve</a>
</div>
</form>
</div>
</div>
Reserve button stays outside of card, why form doesn't fit to card here?
Button should be in card also..
I solved this problem as changing code like this.
<div class="row-content col-sm-8">
<div class="card">
<h3 class="card-header card-warning" style="width: 100%">Featured</h3>
<form class="col-sm-12 row">
<div class="col-xs-12 col-sm-3 align-items-center">
<label><strong>Number of Guests</strong></label>
</div>
<div class="col-sm-9 col-md-9 input-group">
<label class="radio-inline" style="padding-left:">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 2
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 3
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 4
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 5
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 6
</label>
</div>
<div class="col-xs-12 col-sm-3 align-items-center">
<p style="padding: 10px"></p>
<p><strong>Date and Time</strong></p>
</div>
<div class="col-sm-9 col-md-9 input-group align-items-center row">
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar-o fa-fw"></i></span></span>
<input type="text" class="form-control" aria-label="Date" placeholder="Date">
</div>
</div>
<div class="col-sm-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-clock-o fa-fw"></i></span></span>
<input type="text" class="form-control" aria-label="Text input with radio button" placeholder="Time">
</div>
</div>
</div>
<div class="col-sm-3">
</div>
<div class="col col-offset">
<a class="btn btn-primary" href="#">Reserve</a>
</div>
</form>
</div>
</div>
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 would like to make my form in this style as image reference i tried but i did not get success
I made the structure as following code ... if there is someone have any other code reference to share will be good too. thanks
link demo
<div class="row">
<div class="col col-sm-12">
<div class="container"><br/>
<form class="form form-inline form-multiline" role="form">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Pesquisar" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2"><i class="glyphicon glyphicon-search"></i></span>
</div>
</div>
<div class="form-group">
<input type="button" class="btn btn-default" value="Filtros">
</div>
<div class="col col-sm-12">
<div class="col col-sm-4">
<ul>
<h4>Situação</h4>
<li>Útumos incluídos</li>
<li>Todos</li>
<li>Ativos</li>
<li>Excluídos</li>
<li>Inativos</li>
</ul>
</div>
<div class="col col-sm-4">
<ul>
<h4>Tipo de cadastro</h4>
<li>Cliente</li>
<li>Fornecedor</li>
<li>Transportador</li>
<li>Vendedor</li>
<li>Sem tipo definido</li>
</ul>
</div>
<div class="col col-sm-4">
<h4>Outras opções de pesquisa</h4>
<div class="form-group">
<label>Vendedor</label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<div class="row">
<div class="col-md-6">
<label>Município</label>
<input type="text" class="form-control">
</div>
<div class="col-md-6">
<label>Estado</label><br/>
<select name="" id="">
<option value=""></option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label>Telefone / Celular</label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label>Prox. Visita</lebel>
<div class="row">
<div class="col-md-6">
<label>De:</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-md-6">
<label>Até:</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Sem compras no período:</lebel>
<div class="row">
<div class="col-md-6">
<label>De:</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-md-6">
<label>Até:</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
Use the combination of Bootstrap Grid, col-*-*, and use it with your .form-group classes.
Have a look at the snippet below (use full screen mode) or look at the updated Demo.
label {
display: block;
}
.form-group {
margin-bottom: 10px !important;
}
.form-control {
width: 100% !important;
}
.input-group {
width: 100%;
}
.form-holder {
margin: 0 -15px;
}
.form-holder h4 {
padding: 0 15px;
font-size: 14px;
font-weight: bold;
margin-bottom: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col col-sm-12">
<div class="container"><br>
<form class="form form-inline form-multiline" role="form">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Pesquisar" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2"><i class="glyphicon glyphicon-search"></i></span>
</div>
</div>
<div class="form-group">
<input type="button" class="btn btn-default" value="Filtros">
</div>
<div class="col col-sm-12">
<div class="col col-sm-4">
<ul>
<h4>Situação</h4>
<li>Útumos incluídos</li>
<li>Todos</li>
<li>Ativos</li>
<li>Excluídos</li>
<li>Inativos</li>
</ul>
</div>
<div class="col col-sm-4">
<ul>
<h4>Tipo de cadastro</h4>
<li>Cliente</li>
<li>Fornecedor</li>
<li>Transportador</li>
<li>Vendedor</li>
<li>Sem tipo definido</li>
</ul>
</div>
<div class="col col-sm-4">
<h4>Outras opções de pesquisa</h4>
<div class="form-holder">
<div class="form-group col-sm-12">
<label>Vendedor</label>
<input type="text" class="form-control">
</div>
<div class="form-group col-sm-8">
<label>Município</label>
<input type="text" class="form-control">
</div>
<div class="form-group col-sm-4">
<label>Estado</label>
<select name="" id="" class="form-control">
<option value="">Select</option>
</select>
</div>
<div class="form-group col-sm-12">
<label>Telefone / Celular</label>
<input type="text" class="form-control">
</div>
<h4>Prox. Visita</h4>
<div class="form-group col-sm-6">
<label>De:</label>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="form-group col-sm-6">
<label>Até:</label>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<h4>Sem compras no período</h4>
<div class="form-group col-sm-6">
<label>De:</label>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="form-group col-sm-6">
<label>Até:</label>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
Hope this helps!
used:
[class*='col-sm-']:not(:last-child):after