Bootstrap only shows a .valid-feedback / .invalid-feedback message when
it is a following sibling of the control carrying .is-valid /
.is-invalid. A feedback div placed after a bs_*_input() is a sibling of
shiny's input container, not of the control inside it, so it would never
display. bs_feedback() inserts the messages in the right place, whatever
the control's internal structure, and is the supported way to validate a
bootstrict input.
Details
Declare the messages in the UI and switch the state from the server with
set_bs_validation().
Examples
bs_feedback(
bs_text_input("user", "Username"),
invalid = "Please choose a username."
)
#> <div class="form-group shiny-input-container">
#> <label class="control-label form-label" for="user" id="user-label">Username</label>
#> <input id="user" type="text" class="shiny-input-text form-control" value="" data-update-on="change"/>
#> <div class="invalid-feedback">Please choose a username.</div>
#> </div>