Validation
Form validation ensures that the user enters the data that is required and in a correct format, by highlighting errors in their input. This is of equal importance for checkboxes, radio buttons and other form elements.
We included validation styles on form controls. To use, add .has-error to the parent element. Any .control-label, .form-control, and .help-block within that element will receive the validation styles.
Demo enabled on this page! The enhanced keyboard-focus behaviour is active on this page — the .keyboard-focus class is added to each .form-group while a control is keyboard-focused, and removed on blur, click or typing. Try pressing Tab to navigate through the form fields. Read more in the Forms accessibility guidelines.
Inputs, selects and textareas
Add .has-error to the parent .form-group. Inputs, selects, and textareas display errors inline below the field using .help-block with an alert icon. The legacy tooltip-based pattern below is deprecated for removal in v3.0.
Checkboxes and radio buttons
Tooltip error display (deprecated)
Deprecated (v2.5): The tooltip-based error display pattern for input, select, and textarea is deprecated and will be removed in v3.0. Use inline error messages with .help-block below the field instead (as shown above). The tooltip pattern for checkboxes and radio buttons is unchanged for now.
Required fields
For a required field, use .required class on the .form-group div.