Form validation

Form validation gives feedback about invalid user input when the user submits a form.


When to use

Use a form validation in the following cases:

  • When there are required input controls.
  • When there is user input that carries a risk for invalid input.
  • When a form contains dependencies between input controls.


The type of form validation depends on the choice of the input component. There are the following form validation types:

Standard validation

A validation can occur when for example:

  • The datatype isn’t correct.
  • The entered data has too many or not enough characters.
  • No data has been entered in a required field.


Text input as an example for standard validation


Form group as an example for standard validation

Selection group validation

A validation text can occur when for example:

  • Nothing has been selected.
  • Too much has been selected.
  • Not enough has been selected.


Checkbox group validation example

General construction

A form validation consists of the following elements:


1. Message, 2. Inline validation, 3. Indicator line, 4. User input, 5. Validation text

1. Message

  • An error message is displayed above the form and below the content header.
  • For more information on messages, see chapter Message.

2. Inline validation

  • An inline validation informs the user about errors relevant to a specific user input.
  • An inline validation consists of the elements 3. – 5. listed below.

3. Indicator line

  • The indicator line visually highlights an inline validation.

4. User input

  • The user input is in the validation state.

5. Validation text

  • A validation text contains an explanation how to resolve the error.
  • The validation text and the arrow icon are an anchor link to the corresponding input field.


When to validate

There are two possibilities for when a form element can be validated:

  • after typing (“while typing”), meaning after each keystroke
  • after leaving a form field (“on blur”), meaning after clicking elsewhere in the form or leaving parts of a form by navigating through tabs.

The first type of validation should be used whenever an input value must not e.g. contain certain characters or must not exceed a certain length. The second type of validation should be used when an input value as a whole should be validated for compliance, e.g. an email address or a credit card number.

This way we dont expose the user to unnecessary validation errors and show him as few validation errors as needed.

Validation after (re)load

After the user submits a form the page reloads and the viewport jumps to the top. If there is an error, a message appears above the form. This message states a general problem or summarizes multiple errors. The message is persistent until the form is resubmitted without rejection.


Error message above the form

The validation text and the arrow icon are clickable. They link to the corresponding field and on click the related input control is selected.


Validation text with mouseover

If controls have a description, the description text is not highlighted.


Checkbox group with descriptions


A fieldset containing an error, expands after validation of the form.


Expanded fieldset with validation

If the user collapses a fieldset with an error, an indicator line appears.


Collapsed fieldset with validation

Form group responsive behavior

A form group has one common description. All validation texts are listed below the description.


Form group on a large screen

When scaling down the viewport all form elements of a group take on the same width and order vertically below each other. The common description and all validation texts are listed below the last form element.


Form group on a small screen

Do’s & Don’ts


  • Use a validation text to tell the user what went wrong and why it went wrong.
  • Don’t make the user guess why the error occurred.


This chapter shows several form validation styles in the User Experience Toolkit.




Text input




Combo box


Radio button group


Checkbox group



Checkbox group with additional information through description texts



1. Expanded fieldset, 2. Collapsed fieldset with indicator line

Responsive behavior


Example implementation of a form in desktop screen size


Example implementation of a form in mobile screen size


The following table gives reference to the different font sizes and weights:

Validation texterrorSiemens Sans Roman13px17pxleft

Sizing and spacing

The following measurements show the dimensions for this component:


Sizing for form validation


Spacing for form validation in a form group

Form validation

Form validation title

This is an example explanation for form validation.


There are some problems with your input. Please correct them below.
Enter at least 8 characters.
Enter at least 8 characters.
Enter digits.
Enter at least one character.
Select a country.
Enter at least one sentence.
Select one option.
Select at least one option.
* Required fields


.form__formGroup .has-error Marks the form group with a red indicator line on the left.
.form__formGroup.has-error .inputGroup .is-invalid Marks the erroneous form element with a red text color and/or a red border. Marks the form element as a required field with a red asterisk after the label.
Except where otherwise noted, content on this site is licensed under the Development License Agreement.
Back to top