You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that .invalid-feedback is also supported with these classes.
How exactly these classes work, in conjunction with .was-validated, or .setCustomValidity, isn't trivial to infer.
How can both valid and invalid feedback messages be added to a field, so that only one of them is displayed, according to the field's validity status? There are no examples on the page showing both divs; only one of them. I tried setting aria-describedby to the invalid div, but then the valid one was never displayed. I tried adding them both to aria-describedby, and both were displayed.
It's not clearly documented anywhere how the form's .was-validated attribute influences the display of elements with the .valid-feedback and .invalid-feedback classes.
in case you require server-side validation, you can indicate invalid and valid form fields with .is-invalid and .is-valid.
Motivation and context
I've been spending way too much time trying to grok the Form Validation page and running examples to understand how validation works. The docs should make this easy. See also #39407.
The text was updated successfully, but these errors were encountered:
Prerequisites
Proposal
https://getbootstrap.com/docs/5.3/forms/validation/ doesn't document at all the
.valid-feedback
class. The functionality of.invalid-feedback
is assumed to be understood, but is not documented:How exactly these classes work, in conjunction with .was-validated, or .setCustomValidity, isn't trivial to infer.
How can both valid and invalid feedback messages be added to a field, so that only one of them is displayed, according to the field's validity status? There are no examples on the page showing both divs; only one of them. I tried setting
aria-describedby
to the invalid div, but then the valid one was never displayed. I tried adding them both toaria-describedby
, and both were displayed.It's not clearly documented anywhere how the form's
.was-validated
attribute influences the display of elements with the.valid-feedback
and.invalid-feedback
classes.Specifically at https://getbootstrap.com/docs/5.3/forms/validation/#server-side, why not use .setCustomValidity to indicate the validity status?
Motivation and context
I've been spending way too much time trying to grok the Form Validation page and running examples to understand how validation works. The docs should make this easy. See also #39407.
The text was updated successfully, but these errors were encountered: