In my angular js project, I have four checkboxes. in that four checkboxes, three checkboxes have three conditions (like ng-hide and ng-show) and one checkbox has select all and deselects all conditions.
everything working fine. but initially if you select, select all checkbox everything got selected and conditions also working fine(other three checkboxes also got selected). but later without deselecting all checkbox if you uncheck the other three checkboxes that condition (like ng-hide and ng-show) not working.
Any way to fix this?
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app>
<div class="choose-group pt-0">
<input
type="checkbox"
ng-model="exptResultType.status"
value="1" >status
<input
type="checkbox"
ng-model="exptResultType.headercontent"
value=2>header
<input
ng-show="addNlpStepForm.restfulEntity.method != 'HEAD'"
type="checkbox"
ng-model="exptResultType.bodycontent"
value=3>body
<input
type="checkbox"
id="all"
ng-click="(exptResultType.status=exptResultType.all);
(exptResultType.headercontent=exptResultType.all);
(exptResultType.bodycontent=exptResultType.all)"
ng-checked="exptResultType.status&&exptResultType.headercontent&&
exptResultType.bodycontent"
name="exptResultType"
ng-model="exptResultType.all"
value=4>all
</div>
<!-- show status content-->
<div class="form-group pb-30 ts-col-100"
ng-show="(exptResultType.status==true)||(exptResultType.all==true)" >
status code
</div>
<!-- header content -->
<div class="form-group d-flex flex-wrap ts-col-100 pb-10"
ng-show="(exptResultType.headercontent==true)||(exptResultType.all==true)">
header
</div>
<!-- body content -->
<div class="form-group pb-0 ts-col-100" ng-show="(exptResultType.bodycontent==true)||(exptResultType.all==true)">
body
</div>
</div>
The problem is that exptResultType.all will still be true, while the checkbox for all is coupled to the other three values, the property itself is not. The easiest thing to do is ignore the fact it exists for computation purposes:
<!-- show status content-->
<div class="form-group pb-30 ts-col-100"
ng-show="exptResultType.status">
status code
</div>
<!-- header content -->
<div class="form-group d-flex flex-wrap ts-col-100 pb-10"
ng-show="exptResultType.headercontent">
header
</div>
<!-- body content -->
<div class="form-group pb-0 ts-col-100"
ng-show="exptResultType.bodycontent">
body
</div>
Related
I am trying to align the two text field, shown in photo, to the right side of the screen.
I have tried all the solutions to similar questions, here on StackO.
I have tried using offset , and pull-right. Neither worked.
Screenshot
Source Code
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<!-- Search Filter -->
<div class="row filter-row">
<div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12 .col-md-offset-3">
<div class="form-group form-focus">
<input type="text" class="form-control ">
<label class="focus-label">Module Name</label>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12 .col-md-offset-3">
<div class="form-group form-focus select-focus">
<select class="select ">
<option> -- Select -- </option>
<option> Pending </option>
<option> Approved </option>
<option> Returned </option>
</select>
<label class="focus-label">Status</label>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 col-xl-2 col-12 .col-md-offset-3">
Search
</div>
</div>
<!-- /Search Filter -->
as you see, the offset class I added didn't work. Can anyone help me get this stuff over to the right?
Ps. There were initially FOUR input fields, I removed the ones I didn't need. I only need these two...
On your .row or .filter-row class for that specific row add
justify-content: flex-end;
to the class
Then remove the offset and float classes from your columns.
It looks like you're using Bootstrap4, but have applied Bootstrap3 class syntax.
Migration from BS3 to BS4 meant that offset class syntax have changed from:
col-md-offset-3
to
offset-md-3
If you change the syntax on your first column, delete the class reference on subsequent columns (and also delete the float-right class reference which is redundant) then it works - I just edited your live example in the devtools and it works for me.
I have two forms on a page. Both I would like in the left column in a two-column layout, but the second form has input fields stretching onto the second column.
I could of course create two separate "rows". However, the design calls for the top position of the columns to be at the same height, like columns in a two-column layout typically display.
I don't believe this is necessarily related to Bootstrap because this might be solved with other methods, but I was wondering if Bootstrap had a quick solution for this
This following approach is obviously incorrect syntax and moves the form element in and out of flow, but this is basically what I'd like to accomplish:
<div class="container">
<div class="row">
<div class="col-md-6">
<form id="form1">
</form>
...
<form id="form2">
<!-- ... #form2 inputs ... -->
</div>
<div class="col-md-6">
<!-- ... #form2 inputs cont'd ... -->
</form> <!-- end of #form2 -->
</div>
</div>
</div>
I can already separate the forms on two separate rows, but of course, the right column is lower than the left column.
<div class="container">
<div class="row">
<div class="col-md-6">
<form id="form1">
</form>
</div>
</div> <!-- end of row -->
<div class="row">
<form id="form2">
<div class="col-md-6">
<!-- ... #form2 inputs ... -->
</div>
<div class="col-md-6">
<!-- ... #form2 inputs cont'd ... -->
</div>
</form> <!-- // end of #form2 -->
</div>
</div>
Is there any trick to "collapsing" the space above the right column if this is how the html should be structured, or is there a Bootstrap approach that I'm missing? Open to non-bootstrap methods if necessary.
Have you considered using just one form element to wrap the whole lot, and then separating the two forms using their name attributes? For example:
value="form1[field_name]"
value="form2[field_name]"
I have a basic horizontal form written in Angular that uses bootstrap components. My problem is that there is a "Comment field" that pushes down the fields the next column over. I thought my problem might be in nesting <div> tags but I cleaned it up and this is still happening.
I thought of splitting up the form into two sections, the first two columns and the last two, but then I'm worried about complicating it and also ruining the tabbing capabilities.
This is the code for the comment section.
<label for="comment" class="col-md-1 control-label">Tenth Comment:</label>
<div class="col-md-2">
<textarea class="form-control input-sm" rows="8" id="comment"></textarea>
</div>
Here is the Fiddle: http://jsfiddle.net/mkfwaagd/
You could put the IsMessedUp Date and Eleventh Thing within the same column that has it's own 2 rows
<div class="row">
<div class="col-md-4">...</div>
<div class="col-md-4">...text area...</div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<!--Eleventh-->
</div>
</div>
<div class="row">
<div class="cool-md-12">
<!--IsMessedUp Date-->
</div>
</div>
</div>
</div>
I'm using Bootstrap 3.0 with its grid system and have on my page two divs one above the other.
I want to let the users the ability to switch the view so these divs will be one aside the other (on clicking a button). Can I do it using only CSS3?
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="alert alert-info">
<!-- first div content-->
</div>
<div class="alert alert-info">
<!-- second div content-->
</div>
</div>
</div>
</div>
You can use input checkbox for control state and make lable as button. Checkbox must be placed before your code.
In HTML:
<input type="checkbox" id="checkbox">
<label for="checkbox">It's button</label>
<div class="your_div">Your div</div>
Then you have two chunk of CSS:
#checkbox{ %unchecked state% }
#checkbox ~ .your_div{ %unchecked state% }
and
#checkbox:checked{ %checked state% }
#checkbox:checked ~ .your_div{ %checked state% }
Some time ago I test this trick http://codepen.io/KZee/pen/JdZeqv and it works perfect.
I am working on creating a form page.
I have broken the problem into three meta challenges:
Creating the navigation within the form
Producing all the various inputs for the form
Appropriately display items from #2 based on selections in #1.
Right now, I am working on item #2
I have attached the output of my code from within Coda 2
I'm using an accordion for #1 and it appears to work just fine.
When I add the first two items from #2, they also appear to work just fine, staying aligned expected next to the accordion.
Ideally, what I want to do is align the lower radio buttons as well as any subsequent form inputs so they are immediately below the radio button/text inputs that are outside the sidebar and do not wrap under the accordion and into the sidebar. That is what is happening now.
I'm obviously missing something about how to apply my content within the bootstrap grid appropriately using containers, rows and class=col-md-n.
Marston
Here is what I think is the relevant code:
<!-- standard document stuff + jumbotron --->
<div class="container-fluid">
<div class="sidebar">
<div class="col-md-2">
<div class="panel-group" id="accordion">
<!-- NAVIGATION ITEMS --->
<!-- lots of working code that produces the accordion --->
</div>
</div>
</div>
<hr/>
<!-- radio buttons --->
<form class="form-horizontal">
<fieldset>
<!-- bunch of working code here that produces radio buttons --->
</fieldset>
</form>
<hr/>
<!-- Text input --->
<div class="main Content active Content">
<form role="form">
<div class="col-md-3">
<!-- more code here that produces text input --->
</div>
<!-- repeats for each form group --->
<!-- more code that works --->
</form>
</div>
</div>
<!-- check box section _-->
<!-- Preferred Contact Time --->
<form role="form">
<fieldset>
<div class="form-group">
<label class="col-md-3 control-label" for="radios1">Available Weekdays</label>
<div class="col-md-3">
<!-- Lots of radio button code --->
</div>
</div>
<!-- Repeats for 2nd set --->
</fieldset>
</form>
For disclosure, I haven't tasted your code.
From a quick look I have noticed that you're not putting your "col"s into rows. This will cause your layout to act strange.
Standard way to structure your elements is to use col inside row inside container :
<div class="container-fluid">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9"></div>
</div>
</div>
Hope that helps.