Skip to content

Validation

Clear feedback helps people fix mistakes fast. These patterns show valid and invalid states, tooltips, error summaries, requirement lists and success messages.

1Custom validation styles

needs-validation with novalidate shows Bootstrap feedback instead of browser bubbles on submit.

Looks good!
Please enter your first name.
Please enter a valid email.
Please enter your city.

2Server-side states

Add is-valid or is-invalid directly when the server has checked the values.

Username is available.
This code has expired.

3Tooltip feedback

invalid-tooltip floats the message over the layout in a position-relative parent.

Verified
Postal codes have 5 digits.

4Supported elements

Textareas, checks, radios, selects and file inputs all support validation states.

Please add a description.
Please confirm.
Choose a payment option.
Select a category.
Attach a file.

5Browser defaults

Without novalidate the browser shows its own messages for required and typed fields.

6Password requirements

A live-looking checklist below the field shows which rules are met.

  • At least 8 characters
  • Contains a number
  • Contains an uppercase letter
  • Contains a symbol

7Valid feedback

Positive messages confirm that a value has been accepted.

Nice - that name is free.
We will send receipts here.

8Input group validation

has-validation on the group keeps corners rounded around the feedback.

$
Maximum per day is $5,000.
.site
Available.

9Floating label validation

Validation states also work with floating labels.

Missing domain name.
Phone number verified.

10Error summary

An alert at the top lists every problem with links to the fields.

11Inline error with icon

An icon in the feedback line makes errors stand out for scanning.

Only letters, numbers and dashes, no trailing X.

12Pattern attribute

pattern restricts the format; the help text explains it before anyone gets it wrong.

Five digits, for example 84776.
Enter five digits.

13Length limits

minlength and maxlength with a live counter keep handles within bounds.

0 / 20
4 to 20 characters.

14Confirmation mismatch

When two fields must match, mark the second one invalid and say why.

The email addresses do not match.

15Required agreements

Two required checkboxes with feedback before an account can be created.

Required to create an account.
Please confirm you read it.

16Success state

After a successful save, a success alert sits above the validated fields.

Your profile was saved yesterday.

17Soft warning

Not every message is an error: a warning hint lets people continue.

Groups larger than 8 may need two tables. You can still book.

18Required select

A placeholder option with an empty value makes required selects validate.

Please select a country.

19Horizontal form validation

Feedback stays under the field column in a horizontal layout.

Use your work email address.
Looks good.

20Checking availability

A spinner in the addon signals that a value is being checked.

Checking
Checking availability...