Based on http://getbootstrap.com/css/#forms-validation form error class should be has-error

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

el7cosmos’s picture

Status: Active » Needs review
FileSize
507 bytes
bago’s picture

but has-error should be added at input tag level, not on the wrapper level.

el7cosmos’s picture

Bootstrap includes validation styles for error, warning, and success states on form controls. To use, add .has-warning, .has-error, or .has-success to the parent element. Any .control-label, .form-control, and .help-block within that element will receive the validation styles.

bago’s picture

You are right! Sorry!

I also noticed that bootstrap_form_element function ignores #attributes received in input and creates a new $attributes method so there is no way to use THEME_preprocess_form_element in order to add custom classes to the wrapper element.

Maybe adding this line at the top of the method could help:

$attributes = isset($element['#attributes']) ? $element['#attributes'] : array();
markhalliwell’s picture

Title: Form error class » Use "has-error" class on form elements
Status: Needs review » Fixed

Thanks @el7cosmos!

Committed 54d692c to 7.x-3.x:

Issue #2151613 by el7cosmos: Use "has-error" class on form elements.

markhalliwell’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Assigned: Unassigned » ryan.armstrong
Status: Fixed » Needs review

  • Commit 54d692c on 7.x-3.x, 8.x-3.x authored by el7cosmos, committed by Mark Carver:
    Issue #2151613 by el7cosmos: Use "has-error" class on form elements.
    

  • Mark Carver committed 54d692c on 8.x-3.x.x authored by el7cosmos
    Issue #2151613 by el7cosmos: Use "has-error" class on form elements.
    
markhalliwell’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Assigned: ryan.armstrong » Unassigned
Status: Needs review » Closed (fixed)

I'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.