Bootstrap 4.0 invalid-feedback doesn't show - css

I am using the Bootstrap 4.0 (non-beta) validation and have a problem to display the invalid-feedback text.
<div class="form-row">
<label class="form-control-label">Name:</label>
<div class="col-4">
<input class="form-control is-invalid" min="0" type="number"/>
</div>
<div class="col-4">
<div class="invalid-feedback">
Invalid Feedback Text
</div>
</div>
</div>
In the above example the text "Invalid Feedback Text" is not displayed.
The reason for it is that the invalid-feedback div is not a direct sibling of the the input control.
This has been an issue with the alpha/beta versions however I was under the impression that this has been fixed in the 4.0 release. (At least the relevant ticket has been closed.)
So, how can I use the bootstrap validation if I can not have the feedback text as a direct sibling of the relevant input control? (It is simply not feasible in my application.)
Here is a fiddle:
https://jsfiddle.net/zygrsrox/

You're right, the intention is that the input is a sibling of the feedback message. The only way you can force the invalid-feeback to show is to use something like d-block (or some custom CSS selector). Perhaps you can add d-block programatically in your app during validation.
<div class="form-row">
<label class="form-control-label">Name:</label>
<div class="col-4">
<input class="form-control is-invalid" min="0" type="number"/>
</div>
<div class="col-4">
<div class="invalid-feedback d-block">
Invalid Feedback Text
</div>
</div>
</div>

Related

angular flex layout responsive form

we're using this lib : https://github.com/angular/flex-layout
so far, we have below code to achive the fxlayout, but it did not work in mobile device.
<div fxLayout="column" id="width">
<div class="table-cell" fxLayout="row">
<div fxLayout="column" class="columnlabel">
<label class="f_label margintop">width </label>
</div>
<div fxLayout="column leftpadding">
<input type="number" matInput
style="font-weight: bold;background: white;margin-top: 2px;" name="width">
</div>
</div>
</div>
what i am looking for is,
when it is mobile device want input control as underneath to label
when it is large device want textbox on right side
but in some case want input control on right side in mobile also, for example, tongle switch control.
please click on below link for sample representation, and can you please guide me what i am missing ?
sample
provided sample work on stack blitz as requested in comment. Thanks
https://flex-layout-angular-material-wqeqvc.stackblitz.io/
https://stackblitz.com/edit/flex-layout-angular-material-wqeqvc?file=app/app.component.html
What you want to achieve is probably something like that with their responsive API:
<div fxLayout="column" fxLayout.gt-xs="row">
<label class="f_label margintop">Sports </label>
<input type="number" matInput>
</div>
<div fxLayout="column" fxLayout.gt-xs="row">
<label class="f_label margintop">Country </label>
<input type="number" matInput>
</div>
By default with fxLayout, it will be in ROW and when the screen is bigger than xs, then it's in column with fxLayout.gt-xs

Button position middle row on form-inline Bootstrap 4

I'm making a form-inline using Bootstrap 4, but when I use a button, the position of the button is always at the top of the row, I want the button's position to be the same as the input field's position, which is in the middle of the row.
<form role="form" id="form_tambah_kriteria" class="margin-bottom-0">
<div class="form-row">
<div class="form-group col-md-4">
<label>Tipe Decision Maker</label>
<div class="input-group">
<div class="input-group-append"><span class="input-group-text"><i class="ion-ios-contacts"></i></span></div>
<input type="text" name="tipe_dm[]" class="form-control" placeholder="Tipe Decision Maker">
</div>
</div>
<div class="form-group col-md-4">
<label>Owned by:</label>
<div class="input-group">
<select class="form-control" name="owner_dm">
<option value="">0</option>
<option value="1">1</option>
</select>
</div>
</div>
<button class="btn btn-danger">Delete</button>
</div>
</form>
The following is Codepen
The simple fix is to wrap the button in a form-group and prefix it with some invisible text ( or <br />). But it would be dead wrong, just a handy hack, because it would simply hide the underlying problem with your codepen.
The proper fix would be to:
use latest stable version of Bootstrap - your pen currently uses v4.0.0-alpha5 which doesn't contain a lot of bugfixes and, among others, does not contain Bootstrap's flexbox classes)
wrap the button in a .form-group.col-md-4
use d-flex align-items-end classes on the .form-row
Working example: https://codepen.io/andrei-gheorghiu/pen/KKKNxZg
Note: until you start using the latest stable version of Bootstrap's CSS, you'll keep running into problems which seemingly don't make any sense, because the version you're using is a pre-release which does not include a lot of what most Bootstrap 4 examples take for granted.
the solution is easy just add <br> before the button Delete for new line...like this:
<br> <button class="btn btn-danger">Delete</button>
You should put the button in the third column grid and use the <br /> .
you should do it as below:
<div class="form-group col-md-4">
<br />
<button class="btn btn-danger">Delete</button>
</div>

How to make my form full-width in mobile and certain width in desktop via bulma css?

this is my current HTML for display a form field with bulma.
<body>
<div id="root">
<nav class="navbar is-primary is-navbar-sticky">
</nav>
<section class="section">
<div class="container">
<form>
<div class="field">
<label class="label is-medium">
"Title"
<div class="control">
<input type="text" class="input is-medium is-danger" placeholder="Put the title of item here" required="" value="">
<p class="help is-danger">title's length should be equal or greater than 10. Current: 0</p>
</div>
</label>
</div>
</form>
</div>
</section>
</div>
</body>
So far so good.
A problem is that the input will take full width on each breakpoint, it's too much for a desktop resolution.
How to make the input only takes full width for mobile breakpoint while it could take a certain width after the mobile breakpoint.
Is there a bulma way to do this? Rather than write my own css rule?
Your using bulma framework So assign grid system of bulma framework you can use class column in your input element and you can use how much column u you want to set width of input field
<div class="control">
<input type="text" class="input column-12 is-medium is-danger" placeholder="Put the title of item here" required="" value="">
<p class="help is-danger">title's length should be equal or greater than 10. Current: 0</p>
</div>

Bootstrap tooltips moves up has-feedback icon

When using the has-feedback class to add an icon on a form field and using the bootstrap tooltip, the icon moves up. I get the same behavior with chrome, firefox and ie.
<div class="row">
<div class="col-md-5 col-md-offset-1">
<div class="form-group form-group-lg has-feedback">
<input class="form-control" name="foo" placeholder="foo" data-toggle="tooltip" title="Hooray!" type="text">
<span class="glyphicon glyphicon-euro form-control-feedback"></span>
</div>
</div>
</div>
JS File
$('[data-toggle="tooltip"]').tooltip();
Here the example
Bootply
Does anyone know how to solve this problem? Thank you
The reason for it failing is this Bootstrap selector:
.form-group-lg .form-control+.form-control-feedback {...}
When you hover the field, the tooltip's <div> is inserted immediately after the input, thus breaking the + condition since the icon is no longer immediately following the input. A solution is to move the tooltip on the parent element, so that it doesn't interfere with children styling:
<div class="row">
<div class="col-md-5 col-md-offset-1">
<div class="form-group form-group-lg has-feedback" data-toggle="tooltip" title="Hooray!">
<input class="form-control" name="foo" placeholder="foo" type="text">
<span class="glyphicon glyphicon-euro form-control-feedback"></span>
</div>
</div>
</div>
Demo: http://www.bootply.com/tohoEsh0cX

Inline Block input in a form with Bootstrap

I have a form with some inputs and I can't figure out how to put these inputs inline with Twitter Bootstrap. I am new to Twitter Bootstrap.
Here is my code:
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"> <i class="icon-lock"></i>
</span>
<input path="q1" class='input-xlarge' type='text' value='Name of my father'readonly="yes"/>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on"> <i class="icon-lock"></i>
</span>
<input path="r1" class='input-xlarge' type='text' value='' autofocus="autofocus" />
</div>
</div>
</div>
Here is a jsFiddle with my code to well understand my problem: http://jsfiddle.net/XHPMH/1/
Using inline-style attribute I have the result I'm expecting, but I would like to use as many as possible Twitter Bootstrap : http://jsfiddle.net/5Z3rP/
Edit: I'm performing client side validation with jQuery-validation, so I think I have to keep control-group css class
Look at the "Inline Form" section here: http://getbootstrap.com/2.3.2/base-css.html#forms
<form:form class="form-horizontal form-validate form-inline" method="POST" acceptCharset="UTF-8">
http://jsfiddle.net/5Z3rP/1/
I also removed the ".controls" div, which was unnecessary and preventing the inline style.

Resources