question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using b-form-invalid-feedback together with a b-input-group

See original GitHub issue

This might be related to #1566. I have a text input field with a button appended to its right side. I want to show some feedback, when the user enters wrong data. However, with the current setup, this breaks my layout as soon as the text appears, because it throws the button below the error text.

<b-input-group prepend="Serial or part №" class="mb-3">
  <b-form-input type="text" class="form-control" v-model="dataEntryNumber" placeholder="Please enter a serial or part number here" :state="dataEntryNumberInvalid ? false : null"></b-form-input>
  <b-form-invalid-feedback>
    This is not a valid product.
  </b-form-invalid-feedback>
  <b-input-group-append>
    <b-button variant="success" @click="getOrder()" :disabled="!dataEntryNumber || gettingOrder || complaint.articles.length >= 10">
      <font-awesome-icon v-if="gettingOrder" icon="spinner" pulse />
      <font-awesome-icon v-else icon="plus" />
    </b-button>
  </b-input-group-append>
</b-input-group>

Placing the invalid feedback part below the input group (which would sound logic to me), doesn’t work as well, because it must be a direct sibling of the input. So how can I fix this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
tmorehousecommented, May 10, 2019

This is a bootstrap V4.x issue (and has many, many open and closed issues at their GitHub repo).

If you are using javascript validation, I would suggest placing the feedback under the input group and setting the ‘state’ prop on both the input and feedback components.

If you are relying only on browser validation, then you are S.O.L. with Bootstrap V4.x CSS 😦

3reactions
tmorehousecommented, May 13, 2019

Most are closed: but are not resolved:

and more…

it is because of the sibling selector combo needed for native input validation. With “javascript” validation (or server-side validation as bootstrap calls it) we have more control since we can use the state prop of inputs and feedback to force show the validation state and feedback, regardless of placement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form Group | Components - BootstrapVue
Easily add some structure to forms. Its purpose is to pair form controls with a legend or label, and to provide help text...
Read more >
Bootstrap 4 invalid feedback with input group not displaying
I'm using Bootstrap 4.3 and following code worked for me. Try adding "validated" class with "form ...
Read more >
Form Validation | Reference | BootstrapVue
This example shows how to add different validation and feedback to two form fields, as well as dynamically disable the submit button based...
Read more >
Forms - Bootstrap
Checkboxes and radios use are built to support HTML-based form validation and provide concise, accessible labels. As such, our <input> s and <label>...
Read more >
Vue Validation - examples & tutorial
Provide valuable, actionable feedback to your users with Vue form validation, ... Note: We currently recommend using custom validation styles, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found