My problem is that I cannot display my glyphicon before my inputs.
Here is my code:
<div class="modal fade " id="login" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header text-center">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">× </button>
<h4 class="modal-title">Log in</h4>
</div>{{--close modal header --}}
<div class="modal-body text-center">
{{ Form::open(array('url'=>'/' ,'role'=>'form')) }}
#if($errors->count()>0)
<div class="alert alert-danger" style="text-align:center;">
<p>Errors</p>
<ul>
#foreach($errors->all() as $error)
<li>
{{$error}}
</li>
#endforeach
</ul>
</div>
#endif
#if(Session::has('flash_message'))
<div class="alert alert-danger" style="text-align:center;">
<p>{{Session::get('flash_message')}}</p>
</div>
#endif
<div class="form-group">
<span class="glyphicon glyphicon-user ">
{{ Form::text('username', null, ['required'=>'1','placeholder'=>'Username','id'=>'user','class'=>'form-control']) }}
</span>
</div>
<div class="form-group">
<span class="glyphicon glyphicon-lock ">
{{ Form::password('password', ['required'=>'1','placeholder'=>'Password','id'=>'password','class'=>'form-control']) }}
</span>
</div>
<br/>
{{'
'}}
{{ Form::submit('login',['class'=>'btn']) }}
or
{{ Form::button('Sign up',['class'=>'btn btn-danger','data-dismiss'=>'modal','data-toggle'=>'modal','data-target'=>'#signup'])
}}
{{ Form::close() }}
</div>{{--close modal body --}}
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div> {{--close modal --}}
Where rows such as {{ Form::text('username', null, ['required'=>'1','placeholder'=>'Username','id'=>'user','class'=>'form-control']) }}
are Laravel 4 commands which generate input type="text" name="text" class="form-control pleceholder= ...
Please answer only for bootstrap 3..
You could use .form-horizontal, and put your glyphicon in an other column than the field :
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-1 col-sm-offset-3 control-label"><span class="glyphicon glyphicon-user"></span></label>
<div class="col-sm-5">
<input type="text" placeholder="Username" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 col-sm-offset-3 control-label"><span class="glyphicon glyphicon-lock"></span></label>
<div class="col-sm-5">
<input type="password" placeholder="Username" class="form-control"/>
</div>
</div>
<br/>
<input type="submit" class="btn btn-default" value="Login"/>
or
<input type="submit" class="btn btn-danger" value="Sign up"/>
</form>
Play with col-sm-x and col-sm-offset-x to get the width you need.
Bootply
Related
I have little problem. I am going to implement Bootstrap modal with loading some data from database on click, but i am stuck at this:
-> this works just fine and catches click:
<div class="card-body">
<p class="card-text">
<b>Id:</b> #post.Id <br />
<b>Title:</b> #post.Title<br />
<b>Description:</b> #post.Description<br />
<b>Nick:</b> #post.Author<br />
<b>Category:</b> #post.Category<br />
<b>Creation Time:</b> #post.CreationTime</p>
<hr />
<form method="post">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Your comment" name="comment">
<span class="input-group-text"></span>
<input type="text" class="form-control" placeholder="Your nick" name="author">
<button class="btn btn-success" asp-route-postid="#post.Id" asp-route-comment="comment" asp-route-author="author"> Add comment </button>
</div>
</form>
<form method="get">
<div class="py-2">
<button type="submit" name="Id" value="#post.Id" class="btn btn-primary">Load</button>
</div>
</form>
#foreach(var comment in Model.Comments.Where(x=>x.PostId == #post.Id))
{
<b>Comment: </b>#comment.CommentDescription <b>Author: </b>#comment.CommentAuthor <b>Creation Time: </b>#comment.CreationTime<br />
}
</div>
but after implementing Modal it wont work anymore. My front-end looks like this:
<div class="card-header">
<center> <b>Post</b></center>
</div>
<div class="card-body">
<p class="card-text">
<b>Id:</b> #post.Id <br />
<b>Title:</b> #post.Title<br />
<b>Description:</b> #post.Description<br />
<b>Nick:</b> #post.Author<br />
<b>Category:</b> #post.Category<br />
<b>Creation Time:</b> #post.CreationTime</p>
<hr />
<form method="post">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Your comment" name="comment">
<span class="input-group-text"></span>
<input type="text" class="form-control" placeholder="Your nick" name="author">
<button class="btn btn-success" asp-route-postid="#post.Id" asp-route-comment="comment" asp-route-author="author"> Add comment </button>
</div>
</form>
<!-- Modal -->
<form method="get">
<div class="py-2">
<button type="button" name="Id" value="#post.Id" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">Show comments</button>
<button type="submit" name="Id" value="#post.Id" class="btn btn-primary">Load</button>
</div>
</form>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Comments</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
#foreach(var comment in Model.Comments.Where(x=>x.PostId == #post.Id))
{
<b>Comment: </b>#comment.CommentDescription <b>Author: </b>#comment.CommentAuthor <b>Creation Time: </b>#comment.CreationTime<br />
}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
This is my OnGetAsync:
public async Task OnGetAsync(string category, int id)
{
//do something
}
Have you ever had similar problem or know workflow to fix it?
//update
After some work i found this:
<div class="card-body">
<p class="card-text">
<b>Id:</b> #post.Id <br />
<b>Title:</b> #post.Title<br />
<b>Description:</b> #post.Description<br />
<b>Nick:</b> #post.Author<br />
<b>Category:</b> #post.Category<br />
<b>Creation Time:</b> #post.CreationTime</p>
<hr />
<form method="post">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Your comment" name="comment">
<span class="input-group-text"></span>
<input type="text" class="form-control" placeholder="Your nick" name="author">
<button class="btn btn-success" asp-route-postid="#post.Id" asp-route-comment="comment" asp-route-author="author"> Add comment </button>
</div>
</form>
<!-- Modal -->
<form method="get">
<div class="py-2">
<button type="button" name="Id" value="#post.Id" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">Show comments</button>
<button type="submit" name="Id" value="#post.Id" class="btn btn-primary">Load</button>
</div>
</form>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Comments</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
#foreach(var comment in Model.Comments.Where(x=>x.PostId == #post.Id))
{
<b>Comment: </b>#comment.CommentDescription <b>Author: </b>#comment.CommentAuthor <b>Creation Time: </b>#comment.CreationTime<br />
}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
When clicking Load my comments are loaded and "Show comments" button actually shows them, but for every button it show the same comment.
In best way this should work like this:
After clicking "Show comments" its loading comments for single post.
In best way this should work like this: After clicking "Show comments"
its loading comments for single post.
That is because data-bs-target value are all the same so that it will trigger the same modal. You need specify it by adding suffix. Change your code to data-bs-target="#exampleModal_#post.Id" and id="exampleModal_#post.Id".
Whole code below:
//more code.....
<!-- Modal -->
<form method="get">
<div class="py-2">
//change here......
<button type="button" data-bs-target="#exampleModal_#post.Id" name="Id" value="#post.Id" class="btn btn-primary" data-bs-toggle="modal">Show comments</button>
<button type="submit" name="Id" value="#post.Id" class="btn btn-primary">Load</button>
</div>
</form>
//change here.........
<div class="modal fade" id="exampleModal_#post.Id" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Comments</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
#foreach(var comment in Model.Comments.Where(x=>x.PostId == #post.Id))
{
<b>Comment: </b>#comment.CommentDescription <b>Author: </b>#comment.CommentAuthor <b>Creation Time: </b>#comment.CreationTime<br />
}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
I have a basic feedback section, where people can reply to people's feedback. When I click the Reply button, it is supposed to open modal with text to fill and have the FeedbackParentId set to the feedback that has been clicked. However, it is always set to the first feedback.
This is the loop where I simply show all the feedback on the page.
#foreach (var comment in Model.Feedback.OrderByDescending(x => x.CreatedOn))
{
<partial name="_CommentSectionPartial" model="comment" />
}
This is the comment partial itself. Why would the modal get the first ID always?
#model FeedbackViewModel
<div class="comment-list" id="#Model.Id">
<div class="single-comment justify-content-between d-flex">
<div class="user justify-content-between d-flex">
<div class="thumb">
<img src="~/images/blog/c3.jpg" alt="">
</div>
<div class="desc">
<h5>
#Model.Name
</h5>
<p class="date">#Model.CreatedOn.Value.ToLongDateString()</p>
<p class="comment">
#Model.Comment
</p>
</div>
</div>
<div class="reply-btn">
<div class="modal fade" id="replyModal" tabindex="-1" role="dialog" aria-labelledby="replyModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="replyModalLabel">Submit Feedback for #Model.Name</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="send-reply-form" asp-action="AddReply" asp-controller="Business" asp-area="Business">
<input type="hidden" name="feedbackparentId" value="#Model.Id" />
<input type="hidden" name="businessid" value="#Model.Business.Id" />
#Html.AntiForgeryToken()
<div class="form-group form-inline">
<div class="form-group col-lg-6 col-md-6 name">
<input type="text" name="authorName" class="form-control col-form-label" id="name" placeholder="Enter Name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Name'">
</div>
<div class="form-group col-lg-6 col-md-6 email">
<input type="email" name="email" class="form-control" id="email" placeholder="Enter email address" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter email address'">
</div>
</div>
<div class="form-group">
<textarea class="form-control mb-10" rows="5" name="comment" placeholder="Message" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Message'"
required=""></textarea>
</div>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Send Feedback</button>
</form>
</div>
</div>
</div>
</div>
<button id="reply-button" type="button" class="btn btn-primary float-right" data-toggle="modal" data-target="#replyModal">Reply</button>
</div>
</div>
</div>
I tried setting the value through JS like that, does not work.
$(document).ready(function () {
$("#send-reply-form").click(function () {
$("#feedbackparentId").val($(this).data('id'));
});
});
I've fixed it with that piece of code:
$(document).on("click", "#reply-button", function () {
var feedbackId = $(this).data('id');
$(".modal-body #feedbackparentId").val(feedbackId);
console.log(feedbackId);
});
I am working on 2 bootstrap modals - Update modal & delete modal.
Update modal is working perfectly fine on click of update button.
But when I click on delete button(same as for update), delete modal doesnt pop-up, instead I get a black screen.
I am struggling on this issue quite long and not able to get the solution for this.
I have tried doing "inspect element" & compare both the modals, but it seems fine to me.
Also, I have found similar queries on SOF but it did not work.
I have add/remove different css & js files in the script tag but still it didn't work for me.
Below is the code :-
CSS & js links inside head tag :-
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
Update & Delete Buttons to call Modals :-
<td align="center">
<!-- Update Button -->
<button class="btn btn-primary btn-xs" onclick="editEmp(${emp.empid})" data-toggle="modal" data-target="#editemp" data-title="Edit"><em class="glyphicon glyphicon-pencil"></em></button>
<!-- Delete Button -->
<button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#deleteemp" data-title="Delete"><em class="glyphicon glyphicon-trash"></em></button>
</td>
Update Modal :-
<div class="modal fade" id="editemp" tabindex="-1" role="dialog"
aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="left: -600px" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
</div>
<form:form id = "regForm" action="registerEmp" modelAttribute="empreg">
<!-- some form elements -->
</form:form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
Delete Modal
<div class="modal fade" id="deleteemp" tabindex="-1" role="dialog"
aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="left: -640px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
<h4 class="modal-title custom_align" id="Heading">Delete this
entry</h4>
</div>
<div class="modal-body">
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span> Are you
sure you want to delete this Record?
</div>
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-success">
<span class="glyphicon glyphicon-ok-sign"></span> Yes
</button>
<button type="button" class="btn btn-default" data-dismiss="modal">
<span class="glyphicon glyphicon-remove"></span> No
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
Any help is really appreciated.
#CoderDS
Link For Reference
You have missed a closing div. This should get your work done.
Updated HTML
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default panel-table">
<div class="panel-heading">
<div class="row">
<div class="col col-xs-6">
<h3 class="panel-title">Employee Details</h3>
</div>
<div class="col col-xs-6 text-right">
<button type="button" class="btn btn-sm btn-primary btn-create" onclick="createNew()">Create New</button>
</div>
</div>
</div>
<div class="panel-body table-responsive">
<table class="table table-striped table-bordered table-list">
<thead>
<tr>
<th><em class="fa fa-cog"></em></th>
<th class="hidden-xs">Employee Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Address</th>
<th>Country</th>
<th>Contact</th>
<th>Email</th>
<th>Gender</th>
<th>Date of Birth</th>
<th>Education</th>
<th>UserName</th>
<th>Password</th>
</tr>
</thead>
<tbody id="myTable">
<!-- foreach -->
<c:forEach items="${data}" var="emp">
<tr>
<td align="center">
<button class="btn btn-primary btn-xs" onclick="editEmp(${emp.empid})" data-toggle="modal" data-target="#editemp" data-title="Edit"><em class="glyphicon glyphicon-pencil"></em></button>
<button class="btn btn-danger btn-xs" onclick="deleteemp(${emp.empid})" data-toggle="modal" data-target="#delemp" data-title="Delete"><em class="glyphicon glyphicon-trash"></em></button>
</td>
<td class="hidden-xs">${emp.empid}</td>
<td>${emp.firstname}</td>
<td>${emp.lastname}</td>
<td>${emp.address}</td>
<td>${emp.country}</td>
<td>${emp.contact}</td>
<td>${emp.email}</td>
<td>${emp.gender}</td>
<td>${emp.dob}</td>
<td>${emp.education}</td>
<td>${emp.username}</td>
<td>${emp.password}</td>
</tr>
</c:forEach>
<!-- foreach -->
</tbody>
</table>
</div>
<div class="panel-footer">
<div class="row">
<div class="col col-xs-4">Page 1 of 5
</div>
<div class="col col-xs-8">
<ul class="pagination hidden-xs pull-right" id="myPager">
</ul>
<ul class="pagination visible-xs pull-right">
<li>«</li>
<li>»</li>
</ul>
</div>
<div class="col-md-12 text-center">
<ul class="pagination pagination-lg pager" id="myPager"></ul>
</div></div>
</div>
</div>
</div></div></div>
<div class="modal fade" id="editemp" tabindex="-1" role="dialog"
aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
<h4 class="modal-title custom_align" id="Heading">Employee
Details</h4>
</div>
<form:form id = "regForm" action="registerEmp" modelAttribute="empreg">
<div class="modal-body">
<form:hidden path="empid" id="empid"/>
<div class="form-group">
<label class="control-label" for="firstname">Name</label>
<!-- <label>First Name</label> -->
<form:input path="firstname" id="firstname" class="form-control " type="text"></form:input>
</div>
<div class="form-group">
<label class=" control-label" for="lastname">Last Name</label>
<form:input path="lastname" id="lastname" class="form-control " type="text"></form:input>
</div>
<div class="form-group">
<label class=" control-label" for="address">Address</label>
<!-- <label>Address</label> -->
<form:textarea path="address" id="address" class="form-control " placeholder="Enter Address" type="text"></form:textarea>
</div>
<div class="form-group">
<label>Country</label>
<form:select path="country" id="country" class="form-control" placeholder="Select your country">
<form:option value="select">Select Your Country</form:option>
<form:option value="India">India</form:option>
<form:option value="USA">USA</form:option>
<form:option value="Australia">Australia</form:option>
<form:option value="England">England</form:option>
<form:option value="Germany">Germany</form:option>
<form:option value="China">China</form:option>
<form:option value="Pakistan">Pakistan</form:option>
</form:select>
</div>
<div class="form-group">
<label class="control-label" for="gender">Gender</label>
<div class="">
<label class="radio-inline" for="gender-0"> <form:radiobutton
path="gender" name="gender" id="gender-0" value="Male" />
Male
</label> <label class="radio-inline" for="gender-1"> <form:radiobutton
path="gender" name="gender" id="gender-1" value="Female" />
Female
</label>
</div>
</div>
<div class="form-group">
<label>Date of Birth</label>
<form:input path="dob" id="dob" class="form-control " placeholder="Enter Date of Birth" type="date"></form:input>
</div>
<div class="form-group">
<label>Contact</label>
<form:input path="contact" id="contact" class="form-control " placeholder="Enter Mobile/phone number" type="text"></form:input>
</div>
<div class="form-group">
<label>Email Address</label>
<form:input path="Email" id="email" class="form-control " placeholder="xyz#abc.com" type="text"></form:input>
<div class="form-group">
</div>
<div class="form-group">
<label>Education</label>
<form:input path="education" id="education" class="form-control " placeholder="Enter highest education" type="text"></form:input>
</div>
</div>
<div class="form-group">
<label>Username</label>
<form:input path="username" id="username" class="form-control " placeholder="Enter username" type="text"></form:input>
</div><br><br>
<div class="form-group">
<label>Password</label>
<form:password path="password" id="password" class="form-control " placeholder="Enter password" ></form:password>
</div>
<div class="modal-footer ">
<button type="submit" class="btn btn-warning btn-lg"
style="width: 100%;">
<span class="glyphicon glyphicon-ok-sign"></span> Update
</button>
</div>
</form:form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<div class="modal fade" id="delemp" tabindex="-1" role="dialog"
aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
<h4 class="modal-title custom_align" id="Heading">Delete this
entry</h4>
</div>
<div class="modal-body">
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span> Are you
sure you want to delete this Record?
</div>
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-success">
<span class="glyphicon glyphicon-ok-sign"></span> Yes
</button>
<button type="button" class="btn btn-default" data-dismiss="modal">
<span class="glyphicon glyphicon-remove"></span> No
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
I have a angularJs form, which has multiple controls. When the page loads initially, all the contents fit in the form. When the validation messages are shown, the submit button, cancel button are not shown. These buttons are getting below.
Below is the code in index.cshtml. I have only put few controls, additional controls are also there.
<body class="ng-cloak">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
<div ng-controller="testController" ng-init="init()">
<form name="mainForm" id="createForm" ng-submit="mainForm.$valid && add()" novalidate="">
<div>
<!-- HEADER AND NAVBAR -->
<header>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand">Test</a>
</div>
<ul class="nav navbar-right nav-pills">
<li ng-class="{active: createMenu}">
Create</li>
<li ng-class="{active: dashboardMenu}">
Dashboard
</li>
</ul>
</div>
</nav>
</header>
</div>
<div class="container" ng-show="createMenu">
<br />
<div class="row">
<div class="col-sm-2">
<label class="control-label">Groups:</label>
</div>
<div class="col-sm-4 form-group">
<select name="grpTypeSelect" required="" ng-model="selectedgrpType" class="dropdown form-control cl-sm-6" ng-options="grp.GrpTypeName for grp in grpss" ng-change="updateImageUrl(selectedgrpType)">
<option value="">-- Select the Group --</option>
</select>
</div>
</div>
<span id="span1" style="color:red" ng-show="submitted == true && mainForm.grpTypeSelect.$error.required">Group is required</span>
<br />
<div class="row">
<div class="col-sm-2">
<label>Name :</label>
</div>
<div class="col-md-6 form-group">
<input type="text" maxlength="150" class="input-md form-control col-md-4" required="" ng-model="testName" name="testName" />
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.testName.$error.required">Name is required</span>
<br />
<br />
<div class="row">
<div class="col-sm-6">
<label class="control-label">Start date</label>
<div class="form-group">
<div class="input-group date" id="startDatepicker">
<input type="text" required class="form-control" placeholder="MM/DD/YYYY" ng-model="defaultStartDate" name="startDate">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.startDate == '' && mainForm.startDate.$error.required">Start Date is required</span>
</div>
<div class="col-sm-6">
<label class="control-label">End date</label>
<div class="form-group">
<div class="input-group date" id="endDatepicker">
<input type="text" required="" class="form-control" placeholder="MM/DD/YYYY" ng-model="defaultEndDate" name="endDate">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.endDate.$error.required">End Date is required</span>
</div>
<!--/col-->
<div class="col-sm-6">
<label class="control-label">Start Time</label>
<div class="form-group">
<div class="input-group" id="startTimepicker">
<input type="text" required="" class="form-control" placeholder="00:00 AM/PM" ng-model="defaultStartTime" name="startTime">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.startTime.$error.required">Start Time is required</span>
</div>
<div class="col-sm-6">
<label class="control-label">End Time</label>
<div class="form-group">
<div class="input-group" id="endTimepicker">
<input type="text" required="" class="form-control" placeholder="00:00 AM/PM" ng-model="defaultEndTime" name="endTime">
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<span style="color:red" ng-show="submitted == true && mainForm.endTime.$error.required">End Time is required</span>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-6">
<input type="submit" value="Submit" ng-click="submitted=true" class="btn btn-primary" />
<input type="button" id="btnReset" value="Cancel" ng-click="reset()" class="btn btn-primary" />
</div>
</div>
<br/>
</div>
</div>
Is it possible to fit the contents even during the validation messages are shown? i am not setting any specific class to set height. How to make sure that submit and cancel button are also visible, when the form height increases. I checked this link extending a form's height to fit the content in the form , but could not find the solution.
Adding the snippet to show the issue:
Initial load shows as :
After error message:
Thanks
For making anything auto-adjustable according to its content, you can use min-height property.
min-height:100px;
Try this, add it in your form css, like this
<form name="mainForm" id="createForm"
ng-submit="mainForm.$valid && add()"
novalidate=""
style="min-height:100px;">
I'm attempting to have a glyphicon inside of the input field but for some reason it's outside of text box.
<!-- Panel -->
<div class="panel panel-default hidden-xs">
<div class="row">
<div class="col-sm-5 col-sm-offset-1">
<form>
<p><strong>Enter your number and we'll text you a link</strong></p>
<label class="sr-only">Phone Number</label>
<input class="form-control phone-txt" type="text" placeholder="Phone Number">
<button class="btn btn-submit" type="submit">
<span class="glyphicon glyphicon-arrow-right"></span>
</button>
</form>
</div>
<div class="col-sm-5">
<p><strong>Or visit an app store to download now!</strong></p>
<a class="btn btn-default btn-lg" href="#">iOS</a>
<a class="btn btn-default btn-lg" href="#">Android</a>
</div>
</div>
</div><!-- End panel -->
It looks like you have that glyphicon attached to the button. You might try something like this...
<input type="text" class="form-control phone-txt" placeholder="Phone Number" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2"><span class="glyphicon glyphicon-arrow-right"></span></span>